my htaccess rules works fine in Apache but i had to change to LiteSpeed and my page doesnt work properly (eg if i type url like http://domain.com/article/some-article or http://domain.com/article/tags/some-tag ). Maybe somebody coped with similar problem? In server logs i get : Maximum number of redirect reached.
My 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]
I will be grateful for your help
I show you how I coped with the problem - I had to change rules and order - I think there was some loop redirection:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,NC]
RewriteCond %{REQUEST_URI} .articles/tags/([^/]+)$ [NC]
RewriteRule ^(.*)$ articles.php?tag=%1 [L,NC,QSA]
RewriteCond %{REQUEST_URI} .articles/([^/]+)$ [NC]
RewriteRule ^(.*)$ articles.php?article=%1 [L,NC,QSA]
RewriteCond %{REQUEST_URI} .articles.php/tags/([^/]+)$ [NC]
RewriteRule ^(.*)$ articles/tags/%1 [L,R=301]
RewriteCond %{REQUEST_URI} .articles.php/([^/]+)$ [NC]
RewriteRule ^(.*)$ articles/%1 [L,R=301]
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]
#301 redirect error page (instead of 302 - for SEOD reason)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /page-not-found [L,R=301]
</IfModule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.