How to change your default Index page in htaccess

The server looks for specifically named files as the first page of your website, also known as the index page. The default order of index file names our particular servers look through is index.htmindex.htmlindex.php, and finally default.htm. You can change the name of the index file your account looks for by altering the .htaccess file. Perhaps you want to have a specific custom name for your index file or maybe you are migrating from another host and the index page is named differently. This way your internal links will not be broken by renaming the index file.

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. It acts as a liaison between your domain and the server and can perform many functions.

Changing your default index file via htaccess

  1. First you will need to login to your DirectAdmin account to access the .htaccess file
  2. Next you will need to go the File Manager and go into your public_html directory for the domain you wish edit the file and click on the "Edit" link.
  3. You will now have and editing window open so you can edit the file as you see fit.
    In our example below, we decided to make the index page of our folders named first.html.
    #Alternate default index page
    DirectoryIndex first.html
    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
    When done click on the "Save" button at the bottom.

Was this answer helpful?

 Print this Article

Also Read

How to redirect a domain without changing the URL

In this article, we will give you 2 ways in how you can go about redirecting your site to another...