If you are rewriting urls using mod_rewrite module and you think that all your rules and regular expressions are OK but do not work then you must take a look the following directives:
– RewriteLog: File where all rewrite operations will be dumped
– RewriteLogLevel: Controls the amount of information to write to the file specified in RewriteLog. A value of 0 disables the dump of the mod_rewrite actions while a value of 9, produces a large volume of information. It is recommended to establish one value greater than 2 only for the debugging purpose and a value of 0 for production environments.
These 2 directives have the server and virtual host context.
<VirtualHost *:80> ... RewriteLog "/var/log/httpd/rewrite_log" RewriteLogLevel 5 ... </VirtualHost>
# tail -f /var/log/httpd/rewrite_log
From version 2.4 directives RewriteLog and RewriteLogLevel do not exist and its functionality were mixed with the LogLevel directive which now has the following syntax:
LogLevel [modulo:]level[modulo:nivel] ...
The levels can go from emerg to trace8 being trace8 the level that provides more information what would now have the following configuration
LogLevel debug rewrite:trace3
Which means that we would have a debug level for core modules and a level trace3 for the rewrite module. To see de information dumped by rewrite module execute:
# tail -f /var/log/httpd/error_log |fgrep '[rewrite:'