从codeigniter URL中删除index.php

时间:2014-09-04 02:40:31

标签: php .htaccess codeigniter mod-rewrite xampp

我已经复制了代码

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

from here...

并将其复制到新的.htaccess文件中,并将其放在项目的根目录中(D:\ xampp \ htdocs \ testproj)。 但它没有用。
在没有index.php的情况下访问时显示错误404 帮助!

1 个答案:

答案 0 :(得分:1)

这就是你需要的朋友

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]