Can I use a different name for my website's default "index page"?
An "index page" is the Web page that appears when someone visits the top level of your website (or a directory within the site) without specifying a particular file name.
For example, if someone visits http://www.example.com/, the Web server will need to choose a default page, because the URL address doesn't include a file name.
The way a Web server chooses a default page to display is simple: When it receives a request that doesn't include a file name, it consults a list of default file names (such as "
index.htm", and so forth) and displays the first matching file it finds.
That means that if you have a file named "
index.html" at the top level of your website, these two addresses will work identically:
Both addresses display the file named "
index.html". The first does so because the server (invisibly to the visitor) looks through a list of default file names and finds a file matching one of those names (
index.html), and the second does so because the URL address of the request directly tells the server which file to load.
To make sure your website works when a visitor goes to http://www.example.com/ without specifying a page name, you should be sure that the top level of your website contains a file named "
index.html" (or one of the other default file names shown below). The file must be at the top level; the Web server won't be able to find the file if it's inside a folder or directory you published.
The rest of this page shows what the default file names are on our servers and explains how to use a different list if you wish.
Default index file names
Our Web servers look for index files in this order:
index.html index.htm index.shtml index.php index.php5 index.php4 index.php3 index.cgi default.html default.htm home.html home.htm Index.html Index.htm Index.shtml Index.php Index.cgi Default.html Default.htm Home.html Home.htm placeholder.html
If the top level of your website contains a file with any of those names, that file will be shown when visitors don't specify a file name.
You should pick one of these names and use it consistently; it would be very confusing to have files named both "
index.html" and "
index.htm" on your site, for example. If you do so, the first one shown in the list above will be used... but try not to do that: We occasionally receive questions from customers who tell us something like "I've changed my
index.htm file and published it, but my site isn't changing". The problem is that the customer previously placed a file named
index.html on the server (in addition to the file named
index.htm). In that situation, the server never even uses the
index.htm file, because it finds the
index.html file first. The way to avoid this is to make sure you always use the same file name.
Using different index file names
If you want to use an index file name other than the ones above, it's possible for advanced users to change the default names our servers use.
You can do this by using a .htaccess file. The file should contain a line of text like this:
... where "
something.html" is the name of the index file you want to use. (If you do this, our servers will no longer look for "
index.htm", etc. — the
DirectoryIndex command completely replaces the default names.)
It's also possible to specify multiple files to search for, like this:
DirectoryIndex splashpage.html splash.php index.html index.htm
In this example, the server will try to use a file named "
splashpage.html" as the index file. If that file doesn't exist, it will it will look for "
splash.php", then "
index.html", then "
index.htm" (if it runs out of file names to look for, it displays a 404 error page instead).
DirectoryIndex command is explained in more detail in the Apache Web server documentation.
Showing a list of files in a directory
If you just want your visitors to see a list of the files inside the directory (instead of using an index file), our "Enabling Directory Listings" page will help.
Copyright © 2000-2019 Tiger Technologies LLC