Home > Tutorials > HTACCESS Tutorials > Selecting Default Index Files

Selecting Default Index Files

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.

About 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.

Check Also

How To Populate A DIV via an HTML SelectBox, PDO, and jQuery

Imagine you have a database full of information, and you want to let users browse ...

Like every other website, this site uses cookies to analyze our traffic. Cookies may also be utilized by our advertisers and partners. By using this website you agree to the use of said cookies. More Information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings, continuing to navigate past this message, or you click "Accept" below then you are consenting to the use of cookies on the Rapid Purple website.

Close