2016-04-29 119 views
-1

谁能帮我弄清楚为什么我收到此错误,下面是我的htaccess重定向循环错误删除.PHP

RewriteEngine ON 
RewriteRule ^(.*)\.php$ /$1 [R=301,L,END] 
RewriteRule ^([^\.\/]+)$ /$1.php [QSA,L] 
+0

什么是错误?您可能需要查看[如何提问],了解如何在此处提出可回答的问题的一些提示。 – scotthenninger

+2

[Remove .php extension with .htaccess]可能的重复(http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) – starkeen

回答

0

你的第一条规则可能不需要END但第二个规则肯定会需要END标志停止无限重定向。您可以在Apache 2.4中使用以下规则:

RewriteEngine On 

RewriteRule ^(.+)\.php$ /$1 [R=302,L,NE,NC] 

RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.+?)/?$ $1.php [END]