我的 htaccess 规则在 Apache 中运行良好,但我不得不更改为 LiteSpeed 并且我的页面无法正常运行(例如,如果我键入http://domain.com/article/some-article或http://domain.com/article之类的 url /标签/一些标签)。也许有人处理过类似的问题?在服务器日志中,我得到:达到最大重定向数。
我的 htaccess:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# browser requests PHP
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
# check to see if the request is for a PHP file:
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]
RewriteCond %{REQUEST_URI} .article.php/tags/([^/]+)$ [NC]
RewriteRule ^(.*)$ article.php?tag=%1 [L,NC,QSA]
RewriteCond %{REQUEST_URI} .article.php/([^/]+)$ [NC]
RewriteRule ^(.*)$ article.php?art=%1 [L,NC,QSA]
RewriteCond %{REQUEST_URI} .article.php/(.+)$ [NC]
RewriteRule ^(.*)$ http://domain.com/article/$1 [L,R=301]
我会感谢你的帮助