At the risk of turning this into an Apache fan blog, I have to mention the handy directive I found today. Many webmasters run in to mod_rewrite at one time or another and every one of them will have at least a little trouble with it. I just came across the RewriteLog Directive and corresponding RewriteLogLevel Directive. You're not going to be able to turn these on with shared hosting, they can't be used in .htaccess. To set up a debugging log for mod_rewrite, you need to add them to your httpd.conf somewhere. In my case I'm working on a server at home so I added
to the appropriate VirtualHost section. After that I restarted apache and now every request generates a bunch of lines in the log file. Every request that a rule could possibly apply to makes some debug info, so don't forget to remove (or comment out) those lines in the conf file and restart Apache when you're done debugging.
While I'm on the subject, here's the other method that's helped me debug mod_rewrite on shared hosting. I originally found the tip from jdMorgan on Webmasterworld and tweaked it when I was doing a multisite Drupal install (here's my post from back then). Basically what you do is dump some of the info that mod_rewrite is using back out into the headers then use the Firebug or LiveHTTP Headers extensions in Firefox to watch the headers and read your debug info.
In .htaccess use the condition and rule:
You'll have to tweak the example to suit your needs but you can set it to dump anything that mod_rewrite can see in .htaccess.