htaccess更新后的外部循环重定向

时间:2013-01-03 18:41:38

标签: apache .htaccess litespeed

在我的Apache error.log中,我收到了数以千计的错误:

2013-01-02 20:46:44.582 [INFO] [50.18.21.225:48281-1#APVH_example.com] [REWRITE]
     detect external loop redirection with target URL: /index.html, skip.
2013-01-02 20:46:44.582 [INFO] [50.18.21.225:48276-1#APVH_example.com] [REWRITE]
     detect external loop redirection with target URL: /index.html, skip.

我有一个.htaccess文件:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    RewriteCond %{HTTP_USER_AGENT} "Somebot|Otherbot" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Anotherbot" [NC]
    RewriteCond %{REQUEST_URI} !(\/mypages|\/otherpages) [NC]
    RewriteRule ^(.*)$ index.html? [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

如果我注释掉这个块,我不会收到任何错误。但我需要那个谜。

    RewriteCond %{HTTP_USER_AGENT} "Somebot|Otherbot" [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} "Anotherbot" [NC]
    RewriteCond %{REQUEST_URI} !(\/mypages|\/otherpages) [NC]
    RewriteRule ^(.*)$ index.html? [R=301,L]

1 个答案:

答案 0 :(得分:1)

尝试像这样修改该块:

RewriteCond %{HTTP_USER_AGENT} "Somebot|Otherbot" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "Anotherbot" [NC]
RewriteCond %{REQUEST_URI} !(/mypages|/otherpages) [NC]
RewriteCond %{REQUEST_URI} !index\.html
RewriteRule ^(.*)$ index.html? [R=301,L]