Skip to main content

Default Webpage Directory Index .htaccess

When visitors type your domain name into a browser, the server automatically loads a default page—usually index.html. But what if you want a different page, like home.html or index.php, to appear instead? By adding a simple DirectoryIndex directive to your .htaccess file, you can control which file loads first, giving you full flexibility over your site’s entry point. There is a .htaccess code that allows you to specify the file, which loads as your default page whenever anyone types your domain name. Example: If you type http://www.Bluehost.com in your browser's address bar, then the page that loads is index.shtml. You can test this by typing http://www. Bluehost .com/index.shtml and noticing that you get the same result.

  • What to do first
  • Here is the code format?
  • Where do I put this code for an Add-on or Subdomain?
  • Summary

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! Follow the steps outlined below.

What to do first

  1. Log in to your Bluehost Account Manager.

  2. Click Hosting in the left-hand menu. Bluehost Account Manager - Hosting Tab

  3. Click theFile Manager button (or use FTP instead). Account manager file manager

  4. Navigate to your public_html folder and edit or create a file named .htaccess.

  5. Insert the code as described below.

If you need to learn more about how to access and create a .htaccess file, check out our article, .htaccess Tutorial.

What 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 looks for home.html in your root directory, finds it, and loads 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 Add-on or Subdomain?

Instead of creating and editing the .htaccess file inside public_html, do this inside the document root folder of your Add-on or Subdomain name. You will be able to see your domain's document root by following the instructions below:

  1. Log in to your Bluehost Account Manager.

  2. In the left-hand menu, click Websites.

  3. Click the MANAGE button located next to the website you want to manage. Bluehost Account Manager - Website Manage button

  4. Click the **FILES & ACCESS **tab.

  5. Look for the Document Root section. Advanced tab

What to do first

The article shows how to set a custom default page using the DirectoryIndex directive in an .htaccess file. Add the directive with your preferred filenames (e.g., home.html, index.php) so the server loads them in order when your domain is accessed. Place the .htaccess file in your site’s root or the document root for add-on domains/subdomains. These settings apply recursively unless overridden.