How to enable MultiViews in Apache

February 5, 2009 at 5:19 pm

Sometimes, your URLs need to look something like http://hostname.com/list/popular, where popular is not a directory but a popular.php file inside the list directory and you don’t want to specify the file extensions. One reason for this could be that if you are only implementing the view of a web application that calls web services on an application server, the application server may have the URLs implemented that way, so you want to map the same URL paths and format.
Apache makes this easy with the MultiView option, which can be set within <!–[if gte mso 9]> Normal 0 false false false MicrosoftInternetExplorer4 <![endif]–><!–[if gte mso 9]> <![endif]–> <!–[endif]–><Directory>, <Location> or <Files> section in httpd.conf.

The format of the Options directive is:

Options [option 1]  [option 2] … [option n]

So, to enable MultiView, you would set that with the Options directive. For example:

<!–[if gte mso 9]> Normal 0 false false false MicrosoftInternetExplorer4 <![endif]–><!–[if gte mso 9]> <![endif]–> <!–[endif]–>

<Directory "C:/xampp/htdocs">
   #Other directives here...
   Options Indexes FollowSymLinks Includes MultiViews

<!–[if gte mso 9]> Normal 0 false false false MicrosoftInternetExplorer4 <![endif]–><!–[if gte mso 9]> <![endif]–> <!–[endif]–>

   #Other directives here...
</Directory">

Now, by having MultiViews as an option to the Options directive, I can just type http://hostname.com/list/popular, instead of http://hostname.com/list/popular.php

Advertisement

Entry filed under: Distributed Systems, Uncategorized. Tags: , , , , , , , , , , , .

Bash Keyboard Shortcuts CS 462 – Large-Scale Distributed System Design


Calendar

February 2009
M T W T F S S
« Jan   Mar »
 1
2345678
9101112131415
16171819202122
232425262728  

Most Recent Posts


Follow

Get every new post delivered to your Inbox.