Mod_rewrite不适用于一个地址

时间:2014-11-09 22:22:31

标签: php .htaccess codeigniter mod-rewrite

我已经在htaccess文件中添加了一些规则,以便从Code Igniter中的url中删除index.php。但是,对于一个地址,它无法正常工作

网址就像这样“http://example.com/subtitle/eveythingelse/”;

所以当第二个uri是“subtitle”或“sub”时,它不会发送到“index.php”并直接读取不存在的文件夹。

如果我更改第二个uri“http://example.com/changed/everythingelse”它可以正常工作。

我真的很困惑。

这是.htacce的代码:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]


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

1 个答案:

答案 0 :(得分:1)

这是因为最终/

RewriteCond %{REQUEST_FILENAME} !-d

测试目录是否存在,并且不要重写。 您可以删除此条件。