Directory Index

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.centroot.net" in your browser's Address Bar, then the page which loads is "index.php". You can test this by typing "http://www.centroot.net/index.php" 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.

  • 193 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

Why does my FTP fail to connect?

If your FTP progam is not connecting properly, here are some possible reasons: 1. Your firewall...

How to Use Web FTP or browser-based FTP - IE

Input one of the following URLs into your Address Bar, replacing the credentials listed with your...

Flush DNS

Sometimes there is an issue with your DNS resolvers caching the domain name to IP mapping. When...

How to change the password of your cPanel account

There may be times where you would like to change the password of your account. It is recommended...

Internal Server Error help, 500 error

Internal server errors can be caused by a few different things. Please check the Error Logs in...

Powered by WHMCompleteSolution