- The hosting server searches for specific file names to serve as a home page for your website. This default file name order that the server searches for is index.htm, index.html, index.php and default.htm.
- If you want you can change the index file name that the server will search for by editing the .htaccess file. For example, you may want to have a specific index file name or you are transferring your website from another hosting server that the index file was named differently, this way your website’s internal links will not be broken.
- What is an .htaccess file?
The .htaccess file is a hidden text file inside the web server of your hosting account. It is designed so it can be edited to change the behavior of your website. It is a connection between your domain and your hosting server and has various features.
Change your home page index through the .htaccess file
The following steps can help you change the index home page of your website:
Login to cPanel.
Then select the File Manager icon below the Files category.
Next click the Settings button at the top right.
At the popup window select your domain’s root folder, make sure that the Show Hidden Files checkbox is selected and click Save.
When you find the .htaccess file right click on it and select Edit from the pop up menu.
You will be transferred to the editing page of the .htaccess file. Paste the following code at the beginning of the file changing the “first.html” line with the page that you want to be served as your website’s home page.
- You can also set more than one index files as your website’s homepage. The .htaccess file will be read from left to right and the first available page will be selected. For example with the following code the files home.html, index.html and index.php will be added as the website’s index pages. The server will look for the home.html file, if it is not found will continue to look for the index.html file etc.
DirectoryIndex home.html index.html index.php
- When you finish editing your .htaccess file click the Save Changes button at the top to save your changes.