Knowledge Base

How to Change the Default Index Page in .htaccess

If you visit a web address that contains a domain name only, the default index page will display as the first page. If there is more than one index file, the server will follow its default order, which is index.php, index.html, index.htm, and then default.htm.

You may change your default index page by altering the .htaccess file, especially if you have a customised name for your index file. This will also avoid internal links from being broken on your site.

Change your default index page through the .htaccess by following the steps below:

  1. Log in to your cPanel.
  2. On the Home page, click the Files icon or the [ v ] arrow symbol. Click on the File Manager icon.
  3. Locate the .htaccess file, right-click on it, and select Edit.
  4. A text editor pop-up will display. Click Edit again.
  5. The .htaccess editor will appear. Paste the following code at the top of the page, and replace mypage.html with the file name of your index page.
    #Alternate default index page
    DirectoryIndex mypage.html
  6. Click Save Changes at the upper right corner of the page.

Congratulations!Your default index page is now changed. Please let us know if you need any further assistance, or if you have any questions. We’d love to help!

Did you find this article helpful?

* Your feedback is too short