我有以下 htaccess 重写规则。防止循环的一个规则条件最初是这样写的:
RewriteCond %{ENV:REDIRECT_STATUS} ^.
它曾经工作得很好,直到它突然停止工作导致 Apache 显示网站的目录列表。
我必须将其更改为这种新形式,如下面的清单所示,才能让它再次工作:
RewriteCond %{ENV:REDIRECT_STATUS} 200
你知道这种行为的原因吗?
谢谢
RewriteEngine on
RewriteBase /
## Permanent 301
## Force to www. Un-comment in production.
RewriteCond %{HTTP_HOST} !^www\.myhost\.com [NC]
RewriteRule ^(.*) http://www.myhost.com/$1 [L,R=301]
## Permanent redirect rules for contents
RewriteRule ^argument/programming/?$ tags/programming [NC,L,R=301]
## Internal Redirect Loop Protection
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
## Maintenance page
#RewriteRule (.*) special/maintenance.html
## Specials
RewriteRule special/(.*) special/$1 [NC,L]
## Static resources
RewriteRule ^(.*\.(js|ico|gif|jpg|png|css|rss|xml|htm|html|pdf|zip|gz|txt))$ public/$1 [NC,L]
## Front Controller
RewriteRule ^(.*) public/index.php [NC,L]