mod_rewrite is a pain to work with. In order to debug you need RewriteLog and if you’re on a shared host you’re probably stuck with evil .htaccess where Rewritelog is:
.htaccess: RewriteLog not allowed here
So what does one do?
While preparing alpha Debian packages for WP 1.6 I looked at the htaccess Wordpress generates. It’s just:
RewriteRule . /index.php
I didn’t know you could do this. This makes it so much easier to de-crufy URLs. I started an interesting thread on Wordpress hackers which details this sane URL rewriting technique.
Here is the code that implements Wordpress URL rewriting in PHP.