Php 从Apache到LiteSpeed的htaccess迁移

Php 从Apache到LiteSpeed的htaccess迁移,php,apache,.htaccess,mod-rewrite,litespeed,Php,Apache,.htaccess,Mod Rewrite,Litespeed,我的htaccess规则在Apache中运行良好,但我必须更改为LiteSpeed,我的页面无法正常工作(例如,如果我像或一样键入url)。也许有人处理过类似的问题?在服务器日志中,我得到:达到最大重定向次数 我的访问权限: RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # browser requests PHP RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([

我的htaccess规则在Apache中运行良好,但我必须更改为LiteSpeed,我的页面无法正常工作(例如,如果我像或一样键入url)。也许有人处理过类似的问题?在服务器日志中,我得到:达到最大重定向次数

我的访问权限:

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]

我将非常感谢您的帮助

我向您展示了我是如何处理这个问题的-我不得不改变规则和顺序-我认为有一些循环重定向:

<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>

重新启动发动机
重写基/
重写cond%{HTTP_HOST}^www\。
重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L,NC]
RewriteCond%{REQUEST_URI}.articles/tags/([^/]+)$[NC]
重写规则^(.*)$articles.php?标记=%1[L,NC,QSA]
RewriteCond%{REQUEST_URI}.articles/([^/]+)$[NC]
重写规则^(.*)$articles.php?article=%1[L,NC,QSA]
RewriteCond%{REQUEST_URI}.articles.php/tags/([^/]+)$[NC]
重写规则^(.*)$articles/tags/%1[L,R=301]
RewriteCond%{REQUEST_URI}.articles.php/([^/]+)$[NC]
重写规则^(.*)$articles/%1[L,R=301]
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[L,R=301]
#浏览器请求PHP
重写cond%{THE_REQUEST}^[A-Z]{3,9}\/([^\]+)\.php
重写规则^/?(.*)\.php$/$1[L,R=301]
#检查请求是否针对PHP文件:
重写cond%{REQUEST_FILENAME}\.php-f
重写规则^/?(.*)$/$1.php[L]
#301重定向错误页(而不是302-出于SEOD原因)
重写cond%{REQUEST_FILENAME}-F
重写规则/找不到页面[L,R=301]

我向您展示了我是如何处理这个问题的-我必须更改规则和顺序-我认为存在一些循环重定向:

<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>

重新启动发动机
重写基/
重写cond%{HTTP_HOST}^www\。
重写规则^(.*)$http://www.%{HTTP_HOST}/$1[R=301,L,NC]
RewriteCond%{REQUEST_URI}.articles/tags/([^/]+)$[NC]
重写规则^(.*)$articles.php?标记=%1[L,NC,QSA]
RewriteCond%{REQUEST_URI}.articles/([^/]+)$[NC]
重写规则^(.*)$articles.php?article=%1[L,NC,QSA]
RewriteCond%{REQUEST_URI}.articles.php/tags/([^/]+)$[NC]
重写规则^(.*)$articles/tags/%1[L,R=301]
RewriteCond%{REQUEST_URI}.articles.php/([^/]+)$[NC]
重写规则^(.*)$articles/%1[L,R=301]
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[L,R=301]
#浏览器请求PHP
重写cond%{THE_REQUEST}^[A-Z]{3,9}\/([^\]+)\.php
重写规则^/?(.*)\.php$/$1[L,R=301]
#检查请求是否针对PHP文件:
重写cond%{REQUEST_FILENAME}\.php-f
重写规则^/?(.*)$/$1.php[L]
#301重定向错误页(而不是302-出于SEOD原因)
重写cond%{REQUEST_FILENAME}-F
重写规则/找不到页面[L,R=301]

这是个好问题!我希望有人能够回答,因为我在Apache和Litespeed如何处理.htaccess规则方面也存在一些问题。这是一个好问题!我希望有人能够回答,因为我在Apache和Litespeed如何处理.htaccess规则方面也存在一些问题。这是一个好问题!我希望有人能够回答,因为我也有一些关于Apache和Litespeed如何处理.htaccess规则差异的问题。