Pages

Nov 15, 2012

How to debug htaccess errors

Find the httpd.conf in your server. For me this was located at c:\xampp\apache\conf\httpd.conf. Then add the following two lines at the end of the file.

RewriteLog "c:/path_to_your_website/rewrite_log.txt"
RewriteLogLevel 5

Then restart the server.

Now when you access the website a detail log is created in rewrite_log.txt on how the htaccess instructions are processed.

Important Tips:
  1. The best way to debug is before you access any URI on your website clean rewrite_log.txt file. This way atleast you know where to start.
  2. After debugging is complete remove or comment out the above two lines in httpd.conf file. If you don't do this the rewrite_log.txt will keep on growing in the background taking up your precious harddisk space.

No comments:

Post a Comment