Codeigniter删除index.php不起作用

时间:2018-08-07 07:11:29

标签: .htaccess codeigniter

我使用iis服务器,我尝试了一些方法,但是没有用;

config.php

$config['index_page'] = '';

.htaccess;

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>
<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

为什么index.php不能从URL中删除?我该如何以其他方式删除它?

3 个答案:

答案 0 :(得分:0)

DirectoryIndex index.php index.html

<IfModule mod_rewrite.c>

RewriteEngine On
# RewriteBase /yourfoler/
RewriteCond $1 !^(index\.php|assets|install|update) 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For godady Shared Hosting Server uncomment the line below
RewriteRule ^(.*)$ index.php?/$1 [L]

# Please comment this if you have uncommented the above
# RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]

</IfModule>

重新写Htaacess

答案 1 :(得分:0)

您可以尝试一下,请从.htaccess中删除所有代码,然后在下面检查,我不确定,我认为这是可行的

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|install|update)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

答案 2 :(得分:0)

尝试使用此

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

它来自Laravel,但也一直与CodeIgniter一起为我工作。