title: Error: Request exceeded the limit of 10 internal redirects due to probable configuration error
body: <p>This question was already asked a few times but, after reviewing all relevant posts, I still cannot find the solution.
  I am running a VPS (on Ubuntu 14.04) and have the following Apache directives to block spam bots: </p>
  
  <pre><code>RewriteEngine On
  RewriteOptions inherit
  RewriteCond %{HTTP_USER_AGENT} (Yandex|GozaikBot|EveryoneSocialBot) [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} (MJ12bot|Ezooms|Ahrefs|AndersPinkBot) [NC]
  RewriteRule ^(.*)$ - [F,L]
  </code></pre>
  
  <p>When I emulate HTTP requests with user agent matching any of these bot names, as expected, I see "Forbidden" and "You don't have permission to access /index.php on this server", but I also see "<em>Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.</em>" and, most importantly, in the error log I see records like this one:
  "<strong><em>...AH00124: 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.</em></strong>"  </p>
  
  <p>My rewrite rules actually have over 60 blocked bots, I just shortened them here to save space. I get a few thousands hits from these bots daily, so my error log is flooded with these AH00124 errors...</p>
  
  <p>Any thoughts on what's wrong with my rewrite rule? Any suggestions on how to fix the problem? </p>
  
  <p><strong>UPDATE on 4/27/17:</strong></p>
  
  <p>Maybe it has something to do with my server configuration? I have Nging running in proxy mode in front of Apache and the directives listed above have been setup as HTTP/HTTPS directives for Apache. </p>
  
  <p>Here is what I see in the log when increase log level to "debug":</p>
  
  <pre><code>[Thu Apr 27 13:26:38.858812 2017] [core:error] [pid 6671] [client 199.99.99.99:53115] AH00124: 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.
  [Thu Apr 27 13:26:38.861026 2017] [core:debug] [pid 6671] core.c(3518): [client 199.99.99.99:53115] AH00121: r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861052 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861061 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861067 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861073 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861079 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861085 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861091 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861155 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861163 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:38.861169 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r-&gt;uri = /fees.php
  [Thu Apr 27 13:26:39.257662 2017] [core:error] [pid 6669] [client 199.99.99.99:53116] AH00124: 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.
  [Thu Apr 27 13:26:39.257711 2017] [core:debug] [pid 6669] core.c(3518): [client 199.99.99.99:53116] AH00121: r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257718 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257722 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257726 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257730 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257734 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257737 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257741 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257744 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257748 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /error_docs/banned.html
  [Thu Apr 27 13:26:39.257751 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r-&gt;uri = /favicon.ico
  </code></pre>