Change 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.htm, index.html, index.php, and finallydefault.htm. You can change the name of the index file your account looks for by altering the .htaccess file.

How to change your default Index page in htaccess

 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
This way your internal links will not be broken by renaming the index file.

© inmotionhosting.com

Leave a Reply

Your email address will not be published.

*