How to debug rewrite rules with Apache

December 31, 2007

I’ve been thinking about unit testing rewrite rules recently, while deploying a multi-site instance of Mephisto.

Until then, you can debug your rewrite rules using the RewriteLog directive:

RewriteLog "/myfolder/mylogfile.log" 
RewriteLogLevel 3

Please note that:

  • it can slow down your server a lot
  • you should not leave this in production for long (even with RewriteLogLevel set to 0 — instead, remove both directives)

If you want to learn more, see the mod_rewrite RewriteLog documentation.