mod重写规则的问题

时间:2013-04-09 21:36:54

标签: .htaccess

我在htaccess文件中重写规则工作正常,除了一个奇怪的问题,它没有重定向到index.php,就像它应该的那样。

在Debian上运行的apache2

site.com/abc/xyz通过site.com/index.php处理,应该

site.com/somethingelse/folderx/1234通过site.com/index.php处理,就像它应该

site.com/accounts/通过site.com/index.php进行处理 但 site.com/accounts/orders/1234直接处理到site.com/accounts/orders.php,而不是像它应该的那样去root / index.php。

在htaccess中重写规则:

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

我有没有看到一个简单的原因?

1 个答案:

答案 0 :(得分:2)

看起来好像已启用Multiviews。这是内容协商的一部分,可能会导致apache做出意想不到的事情,例如你用/orders/描述的内容 - > /orders.php。尝试将其关闭:

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