What Is the "index.html" Page On a Website?

How to Create Default Web Pages

About.com web design channel homepage
About.com web design channel homepage.

If you've ever picked up a beginning web design book or viewed an online tutorial about building a webpage, you likely found instructions telling you to "save" your HTML document with the file name "index.html". Why is this done? Let's take a look.

Question: What is the "index.html" page on a website?

Answer: The index.html page is the most common name used for the default page shown on a website if no other page is specified when a visitor requests the site.

A More Detail Explanation

Websites are built inside of directories on a web server. Just like you have folders on your computer that you add files to, you do the same with a web server by adding your website files, including HTML pages, images, scripts, CSS, etc.  For your website, you will have each web page as a separate file. For example, your "About Us" page may be saved as "about.html" and your "Contact Us" page may be "contact.html". Your site will be comprised of these .html documents. Sometimes when someone goes to the website, they do so without specifiying one of these specific files in the address. For example:


That URL includes the domain, but there is no specific file listed. This is what happens whenever anyone goes to a URL specified in an advertisement. They are basically going to the homepage of the site, but they have not requested any specific page.

Even though there is no page listed in the URL,  the web server still needs to deliver a page for this request so that the browser has something to display. This file is the default page for that directory.Basically, if no file is requested, the server knows which one to serve up by default. On most web servers, the default page in a directory is named index.html.

In essence, when you go to a URL and do not specify a specific file, the server looks for a default file and displays that automatically - almost as if you had typed in that file name in the URL. Below is what is actually shown if you went to the previously shown URL.


Other Default Page Names

Besides index.html, there are other default page names that some sites use, including:

  • index.htm
  • default.htm or default.html
  • home.htm or home.html

The reality is that a web server can be configured to recognize any file you want as the default for that site. That being the case, it's still a good idea to stick with index.html or index.htm because it is immediately recognized on most servers without any additional configuration needed. While default.htm is sometimes used on Windows servers, using index.html all but ensures that no matter where you choose to host your site, including if you choose to move hosting providers in the future, your default homepage will still be recognized and properly displays.

You Should Have an index.html Page in All Your Directories

Whenever you have a directory on your website, it is a best practices to have a corresponding index.html page.

This allows your readers to see a page when they come to that directory without typing a file name in the URL, preventing  them from seeing a 404 Page Not Found error.

Using a Default File Name Like index.html is a Security Feature as Well

Most web servers start out with the directory structure visible when someone comes to a directory without a default file. This shows them information about the website that would otherwise be hidden, such as directories and other files in that folder. This can be helpful during a site's development, but once a site is live, allowing for directory viewing can be a security vulnerability.

If you don't put in an index.html file in a directory, by default most web servers will display a file listing of all the files in that directory. While this can be disabled at the server level, an easy work around is to simply write a default web page and naming it index.html.

Uploading this to that directory will help solve those problems and close that potential security hole. Additionally, it is also a good idea to also contact your hosting provider and ask for directory viewing to be disabled.

Site That Do Not Use .HTML Files

Some websites, like those that are powered by a Content Management System or ones that use more robust programming languages like PHP or ASP, may not use .html pages in their structure. For these sites, you still want to ensure that a default page is specified, and for select directories in that site, having an index.html (or index.php, index.asp, etc.) page is still desirable for the reasons described above.

Original article by Jennifer Krynin. Edited by Jeremy Girard on 11/10/16