73

My error.log contains:

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.

I replaced loglevel on apache config file:

LogLevel debug

After restarting, I'm getting the same error message without what could be called "a backtrace". As I understand there should be those 10 lines of redirects generated by mod_rewrite regex.

After searching all over the internet I've found plenty of explanations of loglevel and mod_rewrite, but not a word of how to make loglevel debug work.

Any ideas?

BryanH
  • 5,826
  • 3
  • 34
  • 47
Tiger
  • 733
  • 1
  • 5
  • 5
  • 15
    This is a relevant question and should not be closed. Please vote to reopen. – JZ. Oct 16 '15 at 18:25

3 Answers3

84

Do note that on newer Apache versions the RewriteLog and RewriteLogLevel have been removed, and in fact will now trigger an error when trying to start Apache (at least on my XAMPP installation with Apache 2.4.2):

AH00526: Syntax error on line xx of path/to/config/file.conf: Invalid command 'RewriteLog', perhaps misspelled or defined by a module not included in the server configuration`

Instead, you're now supposed to use the general LogLevel directive, with a level of trace1 up to trace8. 'debug' didn't display any rewrite messages in the log for me.

Example: LogLevel warn rewrite:trace3

For the official documentation, see here.

Of course this also means that now your rewrite logs will be written in the general error log file and you'll have to sort them out yourself.

sp00n
  • 1,026
  • 1
  • 8
  • 12
  • For sorting out terminal command `grep` is incredibly helpful. – nuala Apr 30 '13 at 12:19
  • 1
    In apache 2.4 the LogLevel directive is in `/etc/apache2/apache2.conf` on Ubuntu. Seems obvious but it took me a second to figure that out. – Shrout1 Sep 06 '19 at 17:30
40

Edit: note that this answer is 3+ years old. For newer versions of apache, please see the answer by sp00n. Leaving this answer for users of older versions of apache.

For older version apache:

For debugging mod_rewrite issues, you'll want to use RewriteLogLevel and RewriteLog:

RewriteLogLevel 3
RewriteLog "/usr/local/var/apache/logs/rewrite.log"
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
bradym
  • 4,880
  • 1
  • 31
  • 36
33

You need to use LogLevel rewrite:trace3 to your httpd.conf in newer version http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging

Steely Wing
  • 16,239
  • 8
  • 58
  • 54
  • 1
    Just remember to read the warning on that page: "Using a high trace log level for mod_rewrite will slow down your Apache HTTP Server dramatically! Use a log level higher than trace2 only for debugging!" – Mike Jan 10 '18 at 09:59