What is an Index Page (index.php or index.html)

If you want your visitors to see a home page by typing http://yourdomainname.com/ instead of http://yourdomainname.com/mypage.html, you need to define a “default” page. On some servers, this page must be named index followed by an allowable extension. With most shared hosts allowable index page names are:


IMPORTANT:  Unix, many servers’ operating system, is case-sensitive. Your index page  must  be named with all lower-case letters. Index.html does  not  equal index.html.

With most web hosts your account already contains an index page – that’s the “Coming Soon” page you see when you browse your domain name or IP address. To replace that page with one of your own, simply delete the file named index.html and replace it with your own index page.

Order of Precedence

If you have have more than one file named index.* in your directory, the web server will follow a default order of precedence. The precedence may vary by server, but generally it will be similar to this:

index.html ? index.htm ? index.php

You can change the order of precedence and even define competely new index page names by creating (or editing) a file named .htaccess in your www or public_html directory (or in any subdirectory of your www directory. Just add the following line to your .htaccess file:

DirectoryIndex home.html index.html index.php

The file names that appear after the DirectoryIndex specification specify allowable file names that will serve as index pages for the directory. The order in which those file names appear specify the order of precedence.