Blog | Admin | Archives | Random | Recent | Thanks

MultiViews

Ever since I read the article Cool URLs don’t change, I have wanted to try out extension-free URLs. However, the few times I attempted, my .var files, as outlined in Apache’s online documentation on the subject, didn’t seem to be working very well. So I finally read further down that page and came across an alternate method of achieving the same ends: Options MultiViews. I quickly wrote myself up a .htaccess file, and voila: you can access files without their extensions now, like http://arcanius.silverfir.net/wp/index. Apache automatically searches for matching files and serves the best one it finds.

The reason behind doing something like this is that, for example, one can change server technologies (although I’m not about to switch from PHP), without changing URLs. For example, the above link would point equally well to index.html, index.php, index.asp, index.jsp, index.InsertServerTechnologyHere, etc. Likewise, one can use a similar methods to automatically switch between image technologies, because checksum-arcanius-banner points equally well to a .png (which it is) or a .gif, or a .jpg, or any new image technology that might come along.

So, MultiViews is a good thing, in my View. Oh my goodness I’m hilarious!

One Response to “MultiViews”

  1. Bernie Zimmermann Says:

    Is this not on by default? On my server you can go to http://www.bernzilla.com/contact and it resolves automatically (to contact.php). I don’t recall ever having to turn MultiViews on. Hmm…

Leave a Reply