Debugging Apache's mod_rewrite

Updated . Posted . Visible to the public.

Debugging .htaccess is hell, and RewriteRules in particular if they are not working as expected. But fear not! RewriteLog will help you out. \
Add this to your vhost's configuration:

RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 9

After that, restart your Apache httpd and tail the above logfile.

When you are done and all is well: remember to remove those entries again, or set the log level to 0, to switch off rewrite logging.

Arne Hartherz
Last edit
Keywords
RewriteEngine, RewriteCond, RewriteRule, apache2
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2012-11-29 12:20)