Request exceeded the limit of 10 internal redirects


#1

hi guys,
im getting a lot of errors or infinite loops on my site (like 300 times every day).
most of them are created by msn.search.com bot

im getting this error:
[Wed Apr 22 09:40:08 2015] [error] [client 193.144.97.36] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace.

two questions:

  1. how can enable the “Use ‘LogLevel debug’ to get a backtrace” (on a dedicated server)

  2. probably the error is caused by the htaccess file. Can any take a look and see what can be:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^portada/(.*)$ /$1 [R=301,NC,L]

RewriteCond %{REQUEST_URI} ^/movil($|/)
RewriteRule ^(.*)$ /functions/movil.php [L]

RewriteCond %{REQUEST_URI} ^/imprimir($|/)
RewriteRule ^(.*)$ /imprimir.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

thanks


#2

mod_rewrite can be pretty confusing sometimes. It’s okay… we can try to help.

Do you have any idea what URL the search bot is trying to access that causes this error? Since you have the time and IP address for the error, you should be able to look up the corresponding request in your domain’s “access_log” to find the request. It’s possible there’s something unusual about the URLs that’s triggering the error.


#3

i did check the urls, and there is nothing particular… looks like randomly some urls cause the problem with the msnbot and other times is amazonaws.com

this error:
[Wed Apr 22 01:21:55 2015] [error] [client 207.46.13.110] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace.

was this log:
msnbot-207-46-13-110.search.msn.com - - [22/Apr/2015:01:21:55 -0700] “GET /actualidad/plazapublica/1788/Estudios_al_banquillo/ HTTP/1.1” 200 475 “-” “msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)”

this is the url:

i did noticed this:
from this machines msnbot-207-46-13-110.search.msn.com (with different IP) all the errors are came from (+http://search.msn.com/msnbot.htm) and there is no errors coming from (+http://www.bing.com/bingbot.htm)


#4

I checked into your domain, and your .htaccess file is blocking access to msnbot (among many other user agents) by rewriting all of their requests as forbidden:

RewriteCond %{HTTP_USER_AGENT} ^msnbot [OR]
[… a bunch of other agents …]
RewriteRule ^.* - [F,L]

Due to the way Apache rewrite rules work, this rule is causing an error — the rule correctly detects that the user should be denied access and redirects the request to an error page. However, the rule ends up firing again when Apache tries to display the error page to them, forcing them to an error page for the error page. This cycle continues until Apache hits the limit of 10 internal redirects and gives up.

My first recommendation would be that you remove the rule blocking access to msnbot. Blocking access to msnbot is likely to prevent your site from appearing in Bing search results; it’s probably not something you want to do.

Second, you can fix the issue with multiple redirects by adding the following line to the RewriteCond sequence, on a line right before the RewriteRule. (Putting it anywhere else is likely to cause weird problems.) This line makes an exception for the error page, which should make the error disappear:

RewriteCond %{REQUEST_URI} !=/forbidden.html

#5

thanks andrew!!!
everything make sense to me
ill try it and post the results

the error log is a clean sheet now.
perfect solution
thanks again andrew!!