![]() |
|
Customer Support
How can I show a default page other than
index.html?
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 don't want that to happen, see this other FAQ.
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
The above directive must be all on a single line in the .htaccess file.
If you capitalize or change the case of any of your filenames, then they won't match if they are not capitalized the same way in the DirectoryIndex directive. "INDEX.HTML" is not the same as "index.html"
If you have capitalized any of the filenames of your webpages, then you either need to rename them all lowercase, or you should create your own custom DirectoryIndex directive as described above, using whatever filename capitalization you want.
Please read the Apache documentation on DirectoryIndex
User-Contributed Notes |
|
| There are no user-contributed notes for this topic. |
Related Questions:
Why does my website just say "Error 403 Forbidden"?
How do I protect a directory with .htaccess?
How do I stop people from getting directory listings when I dont have an index page?
What do the different HTTP Status Codes like 200, 304, 404, 401, 403 mean?
What options are configured with Apache and what can I do with .htaccess files?
How do I protect a directory with mod_auth_mysql?
How do I stop other websites from using my bandwidth while they steal images, flash, etc. from my site?
Which Apache modules are installed?
How do I make my own Error Documents to replace the default ones like
404 Not Found?How can I make apache recognize different MIME types?
The webservers' Gzip compression is messing up my XML or Flash files for Netscape 4 browsers. How do I turn off compression?
How do I get different character sets to display correctly?
What webserver do you run?
Will I have access to raw logfiles?
I created a symbolic link, and now I am getting a 404 errors.
How do I stop the server from automatically correcting spelling mistakes in URLs or offering multiple choices for documents?
My mod_rewrite rules make my website stop loading.
Why am I getting a 412 Precondition Failed from a website?
How do I protect my website from comment spam?
How do I enforce the use of SSL on my website?
How do I redirect traffic to another web page?
Browse Categories:Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales |

