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!

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

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
11,156 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
13,552 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
13,552 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
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.

thanks

Staff
13,552 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,
John-Paul
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?

Thanks

Staff
21,367 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.

Regards,
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=http://60.195.124.171/~sbtester/images/uploads/ [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=http://www.sbtester.com/images/uploads/%1 [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

 

</IfModule>

Staff
23,972 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

Hello

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 www.mydomain.com/ID/page-not-found or www.mydomain.com/en/page-not-found. whether this is due to his .htaccess? what should i do? please help thank you

Staff
2,033 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? www.indoislamicpedia.com please help regards, Ardhi

Staff
2,033 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
n/a Points
2015-01-29 10:55 pm
How can a user set the server to automatically open his wordpress home page after immediately installing it?
Staff
21,367 Points
2015-01-30 7:39 am
Hello Pentanol,

We're not sure what you're asking, because once you have WordPress installed, the first thing that appears when you type your website URL, is the home page. Your internet browser goes to the page that you set it to go. If you're trying to make the WordPress site your home page, then you need to set your browser settings to do that. WordPress also has an Administrator login page. That is not the first page of the actual website - just checking to make sure that you are aware of this. If you can please explain exactly what you're trying to do, then we can try to provide further assistance.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2015-01-30 6:49 am

Hello

I am not happy with search results for my website's homepage.  My website is built in magento and when i search for "raw audio brand" in Google. My search result for homepage appears as "raw audio raw audio" twice a time. I don't like this. Even my homepage title is different.

Can anyone help me to resolve this issue or any guidance.

 

Thanks

Arun

 

Staff
21,367 Points
2015-01-30 7:35 am
Hello Arun,

Sorry for the problem with the search result. You can (and should) take the issue up directly with Google using Google's WebMaster tools. You should also look at the search terms and any text being used to describe your site. It would also help if you provided information on your website such as the URL and how you built it. Please provide us a little more information and we can look into the issue further.

If you have any further questions or comments, please let us know.

Regards,
Arnel C.
n/a Points
2015-03-18 8:17 am

how to do my login page is default index page and after that open home page of my shop

Staff
13,552 Points
2015-03-19 9:54 am
Hello amit,

Thank you for your question. Are you using a CMS such as Joomla, WordPress, etc? If so, it may be easier to set this up in the Admin Dashboard.

Can you provide a link to your site? This will allow us to view your current setup.

Thank you,
John-Paul
n/a Points
2015-03-20 1:30 am

my weblink is ecommerce.capixatech.in

Staff
23,972 Points
2015-03-23 1:24 pm
Hello Amit,

It appears you are using IIS and ASP for your site. This article is for APache web servers. IIS does not have a .htaccess file. It uses a file named web.config. It will have its own format for changing the default index page.

Kindest Regards,
Scott M

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.

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