Debugging Apache Mod Rewrite

Sometimes trying to figure out why the hell scripts arent working after trying to get search engine friendly URL’s working with Apache’s rewrite module can be a huge pain in the arse.

One way you can get a bit more insight into what may be broken is by adding the Apache Rewritelog & Rewriteloglevel directives to your apache configuration file.

In my development server the lines are added near the end of the VirtualHost directive, which looks something like:

LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On

RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 3

The rewriteloglevel can be any number between 1 & 9, one being the least verbose looging level and nine the most.

**This will not work on servers if you don’t have access to the main apache configution files i.e shared hosting environments.

Leave a Reply

Your email address will not be published. Required fields are marked *