2013-04-09 122 views
1

我在htaccess文件中重写了规则,除了一个奇怪的问题没有重定向到index.php之外。MOD改写规则问题

的Apache2通过site.com/index.php Debian上运行

site.com/abc/xyz过程像它应该

site.com/somethingelse/folderx/1234过程通过site.com/的index.php像它应该通过site.com/index.php

site.com/accounts/过程像它应该 但 site.com/accounts/orders/1234过程直奔site.com/accounts/orders .php不需要root/index.php就可以。 htaccess的

重写规则:

RewriteRule \. - [L] 
RewriteRule (.*)$ index.php [L] 

有没有,我没有看到一个简单的原因是什么?

回答

2

看起来好像您已打开Multiviews。这是内容协商的一部分,可能会导致apache执行一些意想不到的事情,如/orders/ - >/orders.php。尝试将其关闭:

Options -Multiviews 
RewriteRule \. - [L] 
RewriteRule (.*)$ index.php [L] 
+0

太棒了,谢谢。就是这样。如果我早点提出这个问题,我本可以节省很多浪费的工作。 – user2263731 2013-04-09 23:46:05

+0

@ user2263731如果它解决了您的问题,请接受答案作为正确答案 – Ejaz 2013-04-10 11:16:19