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.
  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.
  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.
  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

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

Support Center Login

Social Media Login

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


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


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


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.



Not Found

The requested URL was not found on this server.

10,644 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.

11,669 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,
n/a Points
2014-10-17 9:13 pm

Its the same way to add a new index?

11,669 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.

n/a Points
2014-11-26 12:03 pm

Hello ,

i have some problem that may be ralated to this issue, i have changed the Directory Index for magento store since 4 months and it was working very well tell yesterday because of some one of the store managers have did some changes to the website configuration and it now it gave me "There was no Home CMS page configured or found." and i don't know what to do , i searched many time so please if you can help as my experience with Magento is something little.


11,669 Points
2014-11-26 12:21 pm
Hello Hamada,

Thank you for contacting us regarding Magento. First, make sure you have the Magento Home page setup correctly in the Dashboard.

Also, make sure your Store View is enabled, this should allow it to display.

Thank you,
n/a Points
2014-11-27 4:21 am

Thanks John for your fast reply,

i have ensured that all settings of the homepage and the stores views asre set correctly, any other help?


19,457 Points
2014-11-28 11:47 am
Hello Hamada,

If your settings are correct and they're not working when they once were, then you may need to contact Magento support for further assistance. It appears as the issue is more Magento oriented at this point and this may be something that they are required to address. Apologies that we cannot provide you a direct answer at this point.

Arnel C.
n/a Points
2014-12-16 3:45 am

Thanks for help,

i have solved my problem.

the server was locking my file so i deleted it and created it again and it works fine.

n/a Points
2014-12-15 4:49 am

but i am not able to do this .....This is my htaccess data i need to redirect to custom page #DirectorySlash Off


#AddHandler application/x-httpd-php54 .php


# File modified on Tue Mar 18 10:44:12 2014 by server

# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives

# php_flag magic_quotes_gpc Off

#php_flag register_globals Off


# For security reasons, Option followsymlinks cannot be overridden.

#Options -Indexes +FollowSymLinks

# For security reasons, Option followsymlinks cannot be overridden.

#Options -Indexes +FollowSymLinks 

#RewriteCond %{QUERY_STRING} src=/~sbtester/images/uploads/

#RewriteRule ^src=/~sbtester/images/uploads/$ src= [R=301]

Options -Indexes +SymLinksIfOwnerMatch


<IfModule mod_rewrite.c>

RewriteEngine On


RewriteCond %{HTTPS} on

RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


RewriteCond %{QUERY_STRING} src=/images/uploads/(.*)

RewriteRule ^phpthumb/phpThumb$ /$0?src= [L]


RewriteCond %{REQUEST_URI} !^.*/serverReturns/.*\.php$

RewriteCond %{REQUEST_URI} !^.*/cron/.*\.php$

RewriteCond %{REQUEST_URI} !^.*/test\d*\.php$

RewriteCond %{REQUEST_URI} !^.*/uploadify/.*$

RewriteRule !\.(css|jpg|js|gif|png|ico|eot|woff|ttf|svg|swf|pdf)$ dispatch.php



21,783 Points
2014-12-15 12:16 pm
Hello Krish,

Are you using any sort of content management system such as Joomla, WordPress, etc? If so, it is not likely possible to perform this as it will specifically need index.php.

Kindest Regards,
Scott M
n/a Points
2014-12-17 9:50 am
Ur going well the article with screenshot and written steps helps to understand easily.Thanku..
n/a Points
2015-01-02 12:33 pm


I am confused with this one. I use two languages in my web. English and Indonesian, but when I turn on the url friends, always appears a message like this This page is not available We're sorry, but the Web address you've entered is no longer available. To find a product, please type its name in the field below. that is confusing is when I type a web url, by default that appears is or whether this is due to his .htaccess? what should i do? please help thank you

628 Points
2015-01-02 12:57 pm
Hello Ardhi,

What CMS system are you using? Have you tried clearing your browsers cache after making the changes? Can you please provide your domain so we may see if we can troubleshoot further?

Kindest Regards,
TJ Edens
n/a Points
2015-01-02 1:18 pm

hello Mr. TJ

I'm using prestashop. I've cleared the cache, but the result remains the same.

for my .htaccess i set permissions 777, is this wrong? there is also a confusing me, I use two languages, but why when I changed the language, the products I change in Indonesian did not change in English? please help regards, Ardhi

628 Points
2015-01-02 5:00 pm
Hello Ardhi,

The files permissions for the .htaccess file should be 644. Here is a guide on adding other languages to prestashop.

Kindest Regards,
TJ Edens

Post a Comment

Email Address:
Phone Number:

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

26 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


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:
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!