views:

452

answers:

3

I am having a lot of trouble with mod_rewrite, and for a while I had it going, but for some reason everything has stopped working.

Is there any sort of basic test that I can do to make sure that it is not something fundamental broken.

It does show up in phpinfo();

A: 

Use an .htaccess file to create some rules. If they don't work then something is broken :)

AntonioCS
+1  A: 

RewriteLog and RewriteLogLevel should help you find out what's going on.

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog

As for testing, setup a shell script using curl, run it, then look at the log.

For more robustness, you could write actual tests against the generated log file by parsing it in your scriping language of choice.

Robert Krimen
+1  A: 

A secret that nobody mentions is that mod_rewrite is confusing partly beacuse it's buggy.

Once you're sure you understand it, it does something strange and you get depressed and vow never to touch it again. Earlier this year I found a bug which was described in 2001. That's right, 2001. There's a bugzilla entry for it dating 2006. And a couple of duplicates. The bug is easy to reproduce, yet it still hasn't been fixed.

There's even a patch for it but it hasn't been merged into the code.

Of course, mod_rewrite being mod_rewrite, there's a good chance that there is a logical, simple explanation to what's happening. Code and examples might be helpful.

Artelius