【发布时间】:2011-10-11 11:56:38
【问题描述】:
php_flag display_errors 1
php_value auto_prepend_file init.php
RewriteEngine on
RewriteRule ^$ /id/authenticate [R]
RewriteRule ^login_openid$ /id/login_openid.php [QSA,L]
RewriteRule ^authenticate$ /id/authenticate.php [QSA,L]
RewriteRule ^facebook$ /id/facebook.php [QSA,L]
RewriteRule ^createfromopenid$ /id/createfromopenid.php [QSA,L]
RewriteRule .* - [L,R=403]
这是我的 .htaccess 文件。在 serverconfig 我只有AllowOVerride all。
如果我请求 URL http://mydomain.com/id/authenticate,我会收到 403 错误。如果我删除最后一条规则,它会起作用。 [L] 单位不应该阻止任何进一步的规则发生吗?
编辑:
我的 htaccess 文件位于子文件夹“id”中,因此规则有效。
【问题讨论】:
-
您声明除了最后一个匹配之外没有任何规则是一个有效的想法,但
If I remove the last rule, it works.暗示它们确实有效。此外,您确实假设我的 htaccess 文件位于 Web 根文件夹而不是子文件夹中,事实并非如此,也不是问题的上下文。但是我不需要你的帮助,因为你又错了。我刚刚在 serverfault 上找到了问题的正确答案:serverfault.com/questions/241907/… 原来 L 规则在重写规则匹配时不起作用。
标签: apache http mod-rewrite url-rewriting