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 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.
Learn more about htaccess

Changing your default index file via htaccess

  1. First, you will need to log into your cPanel to access the htaccess file.
  2. Find the Files category and click on the File Manager icon.
    cpanel
  3. A popup box will appear. For the primary domain, click on the Web Root radio button. For addon domains, click on the dropdown and find your desired addon domain name. Be sure the checkbox next to Show Hidden Files is checked. Click the Go button to enter the File Manager.
    file-manager-show-hidden
  4. You should now be in the root folder of the domain you chose. Look for the .htaccess file and right click on it. This brings up a menu. Find and click on the Edit option. If you get a popup box, simply find and click the Edit button in the lower right corner to continue to the editor.
    file-manager-htaccess
  5. You are now in the htaccess editor. 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
  6. Be sure to hit the Save Changes button in the upper right corner to save your new htaccess configuration.
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
forbid users from browsing web directories
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2014-03-03 8:01 am

Wonderful

n/a Points
2014-03-05 12:05 pm

Thanks

n/a Points
2014-06-12 1:11 am

thanks, very useful

n/a Points
2014-07-09 5:20 am
Thanks. Just what I was looking for.
n/a Points
2014-07-14 11:07 am

THANK YOU!!!

n/a Points
2014-07-23 1:20 pm
It is excellent as it is.
n/a Points
2014-09-08 1:45 pm
this is the simple & best method that anybody can understand.just keep it SIMPLE..all the very best.
n/a Points
2014-09-11 11:24 am

Didnt worked for me.

 

getting 

Not Found

The requested URL was not found on this server.

Staff
9,162 Points
2014-09-11 12:16 pm
Be sure that the file name as well as the extension that you are referencing within your .htaccess file are exactly as they are on the server.
n/a Points
2014-09-12 3:05 am

Thanks. I checked and all seems correct. Tried uploading Joomla also and still its not picking default page. So called the hosting support line and they admit that theres a fault at there end and they will fix it by eveving. Lets hope they fix it soon and then will try agin. Thanks for your replies.

n/a Points
2014-10-13 2:15 am

does this mean i can edit the html file coz i dont want to edit the style.css coz am not yet good with css but html.

Staff
9,525 Points
2014-10-13 8:44 am
Hello arthur,

Thank you for contacting us today. This guide allows you to set which file will load when someone visits your website. For example, you can set it to load any of the following files: index.php, index.html, index.htm

There are several ways to Edit Files, which are covered in our guide How do I edit a file on my server?

If you have any further questions, feel free to post them below.

Thank you,
John-Paul
n/a Points
2014-10-17 9:13 pm

Its the same way to add a new index?

Staff
9,525 Points
2014-10-19 9:23 pm
Hello Joe,

Thank you for contacting us. I am not exactly sure what you are asking, but this guide lets you set which file will load when someone visits your website.

Thanks,
John-Paul

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

14 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!