Have a Question?


How to Change your Default Index Page in htaccess

You are here:
< All topics
Table of contents

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.php, index.htm, index.html, 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 the .htaccess file and what do I use it for?

Changing your Default Index File Via htaccess

If you have not created a .htaccess file in the document_root directory for the domain name then you have to type it. File creation or modification can be done with cPanel’s built-in file manager or any FTP client or SSH protocol. You can find a more detailed description of this through the following links:

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
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
Was this article helpful?
0 out Of 5 Stars
5 Értékelés 0%
4 Értékelés 0%
3 Értékelés 0%
2 Értékelés 0%
1 Értékelés 0%
How can we correct this article?
Please submit the reason for your vote so that we can improve the article.