Saturday, October 10, 2009

Apache nice URLs without mod_rewrite

I recently noticed a peculiar behavior in Apache. It seems that if I have, for example, a file /var/www/hello.php, the following URLs will load the same file:
  • http://localhost/hello.php
  • http://localhost/hello
  • http://localhost/hello/goodbye/
After a bit of researching, I found that this behavior is dictated by MultiViews, so if you have that option turned on on your server you can practically forget about rewriting URLs and use this instead.

The only situation I can imagine where you would absolutely need mod_rewrite is if you need to have URLs like, you can't handle that with MultiViews (but you can handle

No comments:

Post a Comment