.htaccess 为什么htaccess重写规则失败?
这两条规则:.htaccess 为什么htaccess重写规则失败?,.htaccess,rewrite,.htaccess,Rewrite,这两条规则: RewriteEngine on RewriteCond %{REQUEST_URI} \.php$ RewriteRule \.php$ /PHPTest/AB/index.php [L] 。。。还有这个: RewriteEngine on RewriteCond %{REQUEST_URI} \.php.*$ RewriteRule \.php.*$ /PHPTest/AB/index.php [L] 。。。导致此错误的原因: 500 Internal Server E
RewriteEngine on
RewriteCond %{REQUEST_URI} \.php$
RewriteRule \.php$ /PHPTest/AB/index.php [L]
。。。还有这个:
RewriteEngine on
RewriteCond %{REQUEST_URI} \.php.*$
RewriteRule \.php.*$ /PHPTest/AB/index.php [L]
。。。导致此错误的原因:
500 Internal Server Error
为什么?您的规则正在生成
500内部服务器错误
,因为您正在导致无限循环,并且当Apache超出最大重定向限制时,它将向浏览器返回500个http代码
如果要修复它,请将代码更改为:
RewriteCond %{REQUEST_URI} !^/PHPTest/AB/index\.php
RewriteRule \.php$ /PHPTest/AB/index.php [L]
上面的
RewriteCond
将在第一次重定向到/PHPTest/AB/index.php后阻止执行。php
您的规则正在生成500内部服务器错误
,因为您正在导致无限循环,当Apache超出最大重定向限制时,它将返回500个http代码到浏览器
如果要修复它,请将代码更改为:
RewriteCond %{REQUEST_URI} !^/PHPTest/AB/index\.php
RewriteRule \.php$ /PHPTest/AB/index.php [L]
在第一次重定向到/PHPTest/AB/index.php后,上述RewriteCond
将阻止执行