Question: What is the index.html page?
Every website is built inside directories on a web server. And each web page is a separate file on that web server. But sometimes, when you go to a URL, there is no file listed in the URL. For example:
But even though it's not listed in the URL there is still a file that the web server serves in order for that URL to display anything other than an error page. This file is the default page for that directory. On most web servers, the default page in a directory is named
In other words, when you go to a URL without a file name at the end, the server looks for a default file and displays that automatically. Just as if you had typed in that file name in the URL:
There are Three Default Page Names
There are three commonly used default page names that you can use on most web servers:
- default.htm (on some Windows servers)
It's a good idea to stick with index.html or index.htm on most servers, as default.htm is most often used on Windows servers, and isn't as common as it used to be.
You Should Have an
index.html Page in All Your Directories
Whenever you have a directory on your website you should have an
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.
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.
If you don't put in an index.html file in a directory, most web servers will display a file listing of all the files in that directory. While in some situations, you might want that, most of the time this is ugly at best and a security hole at worst. Writing a default web page and naming it index.html helps solve those problems.
The default file keeps those files and directories hidden so that they are more difficult to find if you don't link to them. Note, this isn't a strong security feature, but it's a good idea nevertheless.
Your Home Page Should be an
When you start building your website, you should create your main page and name it
index.html. This is true whether you're using a free hosting service or you have your own domain name. That way, when people come to your URL, they automatically get your main page. All other pages will have names like
contact.html, but your home page should file should be called
index.html. Then all your readers need to type is your domain name.