How to set/change the Default Page using .htaccess Print

  • 0

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 behaviour of your website that normally would take higher access beyond your account.

Kindly follow the below steps for setting/changing the Default Page of you domain via htaccess :

1. Login into the cPanel to access the htaccess file.

2. Under the Files category,click on the File Manager icon.

3. A pop-up box will appear. Click on the Web Root radio button. Be sure that the check-box next to Show Hidden Files is checked. Click the Go button to enter the File Manager.

4. You should now be in the root folder of you domain. 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 pop-up box, simply find and click the Edit button in the lower right corner to continue to the editor.

5. You are now in the htaccess editor. Insert the code as described below :

DirectoryIndex start.htm

This would cause start.htm to be treated as your default page.

NOTE : Please replace start.htm with the default page name that you wish to set.

6. Once you have done the changes, be sure to hit Save Changes button in the right corner to save your new .htaccess configuration.

You can also list more than one file name in the configuration. The file will be read from left to right and check for them in that order.
In the below example, we added home.htmlindex.php & index.html to the list. So first the server will check for start.htm, if it does not find a file with that name, it continues to find home.html and so on.

DirectoryIndex start.htm home.html index.php index.html

NOTE : The above directives must be all on a single line in the .htaccess file.

If you capitalize or change the case of any of your file names, then they won't match if they are not capitalized the same way in the DirectoryIndex directive. E.g. "INDEX.HTML" is not the same as "index.html".


Was this answer helpful?

« Back