How can I debug mod_rewrite rules?

Other possibility:

use this online htaccess tester:

http://htaccess.madewithlove.be/


Very helpful insight. For years I've been trying to figure out how to debug mod_rewrite rules without needing to have root access and having to put the rules in httpd.conf. This does it!

You have one minor mistake in your PHP:

<?='<pre>',htmlentities(print_r($_GET),true),'</pre>'?>

In this code, print_r() outputs everything in $_GET to stdout and then returns the value true, which htmlentities() picks up as its first argument. htmlentities() also receives the literal true as its second argument, which is an optional argument that tells htmlentities() whether or not to mess with single- and/or double-quotes.

I think what you intended was:

<?='<pre>',htmlentities(print_r($_GET, true)),'</pre>'?>

This tells print_r() to format everything in $_GET. Passing true as the second argument to print_r() tells it not to output the result to stdout, but instead to put the result in a string and return that string as print_r()'s return value. htmlentities() then receives that string as its one input parameter, and does appropriate substitutions to force the browser to display the string as is rather than allowing the browser to interpret the string. E.G. -

<i>text</i>

would get translated to:

&lt;i&gt;text&lt;/i&gt;

which will cause the browser to display:

<i>text</i>

instead of displaying the word "text" in italics:

text