Show a default page other than index.html

by Rekha 2010-02-09 14:44:47

The DirectoryIndex directive controls what page will be shown when a client asks for a directory in their browser.

By default, DirectoryIndex directive is set to:

DirectoryIndex index.html index.htm default.htm index.php index.php3 index.phtml index.php5 index.shtml mwindex.phtml

Apache will look for each of the above files, in order, and serve the first one it finds when a visitor requests just a directory. If the webserver finds no files in the current directory that match names in the DirectoryIndex directive, then a directory listing will be displayed to the browser, showing all files in the current directory.

If you want to change your own DirectoryIndex to either add a different filename, shorten the list, or change the order of the list, just create a file named .htaccess in the directory where you want this behavior to occur. Inside the .htaccess file, put a single line beginning with DirectoryIndex followed by the list of filenames that you want Apache to serve first when a directory has been requested, like so:

DirectoryIndex index.phtml start.html

Tagged in:


You must LOGIN to add comments