Most web hosts setup your account to use a specific file as the index file. In most cases this is either index.html, index.php, index.htm or defualt.html, but what happens if you don’t want to use any of those names for your index file? What if you want your index file to be called thestart.php (for example). Well once again we can use .htaccess to help us out.

We use the DirectoryIndex command and then create a list of the index files we will be using throughout the site. The server will work from left to right, checking to see if each file exists, if none of them exists it will display a directory listing (unless, of course, you have turned this off). The code for this will look like this:

DirectoryIndex thestart.php myindex.html blog_starts.shtml forums.php3

You can also save yourself some time and use our new .htaccess generator to quickly and easily create an .htaccess file.

Published by Michael Boguslavskiy

Michael Boguslavskiy is a full-stack developer & online presence consultant based out of New York City. He's been offering freelance marketing & development services for over a decade. He currently manages Rapid Purple - and online webmaster resources center; and Media Explode - a full service marketing agency.

Leave a comment

Your email address will not be published. Required fields are marked *