Your Cart is Empty Reseller Login or Sign up FAQ Search

Changing the directory index file

On our servers the default index files are index.php and index.html. So, whenever anyone visits your website, the server opens index.php or, if it is not present, it opens index.html. If none of them is present in the home directory of your domain, the server would show a list of the files in this directory - the so-called directory index.

But what if you want the server to open home.html instead?

What you need to do is change the directory index file. This is done via .htaccess with the following line:

DirectoryIndex main.html

And here are more detailed instructions on how to do it:

Option 1: Creating an .htaccess file manually

Using the File Manager tool located in your Web Hosting Control Panel (Site Options > File Manager) you can create an empty file called .htaccess and edit it to enter the necessary code in it. The afore-mentioned code could be modified slightly for more flexibility:

DirectoryIndex main.html index.php index.html

The code displayed above "tells" the server that the default directory index file is the one called "main.html", but if there is no such file in the directory, it should open "index.php" and if this one is not present either, it should open "index.html". If none of these files is present, the server displays the directory index (a list of the files).

IMPORTANT NOTE: All directives inside an .htaccess file are valid for the directory where the .htaccess file is located and for all the sub-directories as well, i.e. it works recursively!

Option 2: Using the .htaccess Generator

Another option is to use the .htaccess Generator form instead of creating the file yourself. Go to Web Tools > Elefante Administration Tools > .htaccess Generator. You will see various options for the rules that you can define with an .htaccess file. The very first box is the location where the file will be created. Click on "Set Location" and choose the main folder of your domain. Just below that box, the first .htaccess option is called "Default index page". Select the checkbox, then type "main.html" (the file that you want to be opened first). Scroll to the bottom of the page and click on "Generate .htaccess". Next you will see the content of the file, including any other options that you may have selected along with the Directory index file. Click on "Create file" to create the .htaccess file in the desired domain folder.

« Back to menu