HostGator.com » Support Portal



Directory Index

cPanel

This is a .htaccess code which allows you to specify the file which loads as your default page whenever anyone types your domain name.

EXAMPLE: If you type "http://www.hostgator.com" in your browser's Address Bar, then the page which loads is "index.shtml". You can test this by typing "http://www.hostgator.com/index.shtml" and noticing that you get the same result.

Tired of seeing the index.html file when you go to http://yoursite.com ? Want to see home.html or Index.php instead? No problem!

What to do first.

  1. Login to cPanel and go to the File Manager (or use FTP instead).
  2. Navigate to your public_html folder and edit or create a file named .htaccess.
  3. Insert the code as described below.

Here is the code format.

DirectoryIndex filename.ext

This would cause filename.ext to be treated as your default page. You can also append other filenames to it. You may want to have each folder without filename.ext to use a different page name as the default page. That's no problem too.

DirectoryIndex home.html index.php index.shtml page1.php

Placing the above code in your .htaccess file will cause this to happen. When a user types in yoursite.com, your site will look for home.html in your root directory, find it, and load that page as the default page. If it does not find home.html, it will then look for index.php; if it finds that one, it will load it, if not, it will look for index.shtml and the whole process repeats until it finds a file it can use. The list of files is read from left to right.

The .htaccess file is recursive, meaning it affects all the subfolders that do not have their own .htaccess file.

Where do I put this code for an Addon or Subdomain?

Instead of creating and editing the .htaccess file inside public_html, do this inside the document root folder of your Addon or Subdomain name.


cPanelcPanel is a popular web hosting control panel that helps you manage your hosting account and assists you in creating web sites, managing e-mail addresses, & installing applications to a server.

cPanel is available on all HostGator Linux hosting plans, including Shared Hosting, Reseller Hosting, VPS and Linux Dedicated Servers.

Article Comments

eleanor
I am trying to install wordpress and am getting this message:

- You chose to install in the main directory of the domain thepurplebow.com, but there are conflicting filenames, therefore we can not proceed. Following filenames already exist in the main directory of the domain thepurplebow.com (path="/home/elpoppe/public_html/").You must manually remove these files before proceeding with auto-installation:
fantversion.php
license.txt

Can you tell me how to proceed?
thanks

HostGator
You must delete these files from public_html before you can instal WordPress:

fantversion.php
license.txt

Andrew
Perfect answer for elanor. It helped me and I had the same issue. Thank you so much.

KD
I have an .html page up until the site goes live, then I want mysite.com to lead to my Joomla! front page. Putting "DirectoryIndex index.php" in the .htaccess already in my public_html folder changed nothing, neither did "DirectoryIndex toybox/index.php" or even "DirectoryIndex defaulted.html" which is the name I gave the default html file when I put the In Progress html page up.

Help?

HostGator
There may be another "DirectoryIndex" code somewhere which takes priority.

Please contact us via email, phone or live chat for personalized assistance.

KD
I got it! When I went from CPanel to File Manager, had to tell it to show hidden files. Never noticed that ticky box before!

HostGator
Thank you for your comments. Just a quick reminder that the comments on this page are not monitored by technical support staff, and that for support issues, it is best to contact us by live chat, phone or email so we can assist you right away.

Although comments are not monitored by technical support staff, they are moderated and read by technical writers. Comments will need to be approved by a moderator before appearing.

Our technical writers do read the comments periodically for the purposes of updating the articles, and do appreciate your feedback, suggestions and corrections to the articles themselves, as well as any suggestions or tips for readers of this article. However, support questions posted here are not guaranteed to be replied to in a timely manner or at all. For support issues, it is best to contact our support staff instead by live chat, email or phone.



Your comments help us keep the knowledge base updated. This is not a medium for support. If you have questions or need help, please contact us via email, phone or live chat for fast assistance.

Post Comment