Rewrite Tracing

Debugging with LogLevel rewrite:trace

mod_rewrite logs nothing below trace1 and nearly everything at trace8. Raise the level for the module alone, in the virtual host or a <Directory> section; in .htaccess, LogLevel fails with a 500 and LogLevel not allowed here.

Tracing mod_rewrite while every other module stays at warnApache config
LogLevel warn rewrite:trace4

trace1 shows outcomes, trace2 each rewrite, trace3 prefix handling and every pattern tried, and trace4 each condition with its expanded input. Lines also carry a timestamp, PID, client and request ID ([rid#.../initial/redir#1]). Pass two of /products/7 under Stopping Rewrite Loops's file:

Output of 48
trace3 initial/redir#1 applying pattern '^show\\.php$' to uri 'show.php'
trace4 initial/redir#1 RewriteCond: input='GET /products/7 HTTP/1.1'
  pattern='^\\S+\\s/show\\.php[?\\s]' => not-matched
trace3 initial/redir#1 applying pattern '^' to uri 'show.php'
trace4 initial/redir#1 RewriteCond: input='/var/www/example/show.php'
  pattern='!-f' => not-matched
trace1 initial/redir#1 pass through /var/www/example/show.php

It shows which pass ran, what the pattern saw (show.php, no slash), what a variable expanded to (THE_REQUEST still holds /products/7), and why nothing fired. The manual warns that high levels slow the server "dramatically": go above trace2 only while debugging, then return to warn.