What is an .htacces file?
The .htaccess file is a hidden text file within your hosting account that can be very powerful. It is designed so that you can modify it to change the behavior of your website that normally would take higher access beyond your account.
Changing your default index file via .htaccess
- You will have to login to your cPanel
- On the ” Files ” tab, you will see the File Manager icon.
- A popup box will appear. For the primary domain, click on the Web Root button. Also, you will have to tick the ” Show hidden files ” option. Click the Go button to enter the File Manager.
- You should now be in the root folder of the domain you chose. Look for the .htaccess file and right click on it. This brings up a menu. Find and click on the Edit option . If you get a popup box, simply find and click the Edit button in the lower right corner to continue to the editor.
- You are now in the htaccess editor. Paste the following code at the top of the page to configure your desired index page. In our example below, we decided to make the index page of our folders named first.html.#Alternate default index page
You can also list more than one file in the configuration. The file will be read left to right and check for them in that order. In this example, we add index.htm, index.html, and index.php to the list. First the server will check for first.html, if it does not find a file with that name, it continues to index.htm and so on.
#Alternate default index pages
DirectoryIndex first.html index.htm index.html index.php
- Press the Save button in the upper right corner to save your new .htaccess configuration.