This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

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.Justhost.com" in your browser's Address Bar, then the page which loads is "index.shtml". You can test this by typing "http://www.Justhost.com/index.shtml" and noticing that you get the same result.

Tired of seeing the index.html file when you go to http://example.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.

Knowledgebase Article 196,928 views bookmark tags: cpanel htaccess


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

How to Stop A Directory Index From Being Shown
Knowledgebase Article 301,121 views tags: directory htaccess index

How do I display my home page which is using a name other than index.html?
Knowledgebase Article 331,297 views tags: directory homepage htaccess index order

Explains how to edit the .htaccess
Knowledgebase Article 371,132 views tags: htaccess

Related Help Content

How do I make a sub directory (or sub folder) act as the public_html for your main domain?
Knowledgebase Article 1,098,995 views tags: Drupal domain htaccess joomla wordpress

What is the .htaccess file and where can I find more information?
Knowledgebase Article 2,084,029 views tags: htaccess tips tricks

What is the Index Manager? How do I use the Index Manager?
Knowledgebase Article 196,072 views tags: index manager

How to run CGI scripts for Addon domains.
Knowledgebase Article 234,045 views tags: cgi htaccess

The redirection of www.yourdomain.com/default.html or index.html to http://www.yourdomain.com/index.php?act=whatever redirects it to http://www.yourdomain.com/index.php%3fact=whatever In other words,
Knowledgebase Article 1,037,029 views tags: htaccess messing mod php redirect redirects rewrite variable variables

500 Internal Server Error when installing via the MOJO Marketplace installer.
Knowledgebase Article 285,115 views tags: cpanel errors htaccess panel php script simpel

How do I perform a URL redirect/rewrite using the .htaccess file?
Knowledgebase Article 1,937,968 views tags: htaccess redirect rewrite url

Preventing bandwidth theft using the mod rewrite engine and .htaccess
Knowledgebase Article 209,693 views tags: htaccess rewrite

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.