Domanda

In my Apache error.log I get thousands of this error:

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.

I have such a .htaccess file:

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

If I comment out this block, I don't get any error. But I need that for mysite.

    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]
È stato utile?

Soluzione

Try modifying that block like this:

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] 
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top