+1-855-211-0932 (ID:287497)
Don't have an account yet? Sign up now!

HomeArticlesHow to Change the Directory Index File (Home/Default File)

How to Change the Directory Index File (Home/Default File)

How to Change the Directory Index File (Home/Default File)

How to Change the Directory Index File (Home/Default File)

Category: Tools & Settings

Understanding Directory Index Files

By default, our servers recognize index.php and index.html as the main index files for your website. When a visitor accesses your domain, the server checks for these files in the order mentioned. If neither is found, a directory listing is displayed.

Changing the Default Index File

To set a different file, like home.html, as your default, you will need to modify the directory index file using the .htaccess file.

Option 1: Creating an .htaccess File Manually

Follow these steps to create or edit the .htaccess file manually:

  1. Navigate to Files > File Manager in your Web Hosting Control Panel.
  2. Locate your domain's root folder (usually /www/mydomain.com/).
  3. If there is no .htaccess file, create a new file called .htaccess.
  4. Edit the .htaccess file and insert the following line:
DirectoryIndex main.html

This code instructs the server to prioritize main.html as the default index file. If it's absent, the server will fall back to index.php or index.html.

Important Note

All directives in the .htaccess file apply to the directory where the file resides and all its subdirectories, meaning it works recursively.

Option 2: Using the .htaccess Generator

If you prefer a simpler method, you can use the .htaccess Generator tool:

  1. Go to the Advanced menu and select .htaccess Generator.
  2. Choose the main folder of your domain by clicking on "Browse."
  3. Check the box for "Default index page" and type main.html.
  4. Click on the Generate button.
  5. Review the content, which includes your selected options along with the Directory index file.
  6. Finally, click Save .htaccess to create the file in the designated folder.


Tags: , , , , ,

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>