index.html
Definition
index.html is a naming convention, not a special format — the file itself is ordinary HTML. What makes it special is that servers are configured to look for it whenever a request ends at a directory. Ask for https://example.com/ and the server serves the index.html sitting at the top of the folder; ask for /pricing/ and it serves pricing/index.html. This is called the directory index, and it is why URLs can end in a tidy slash instead of naming a file. Some servers accept other names in the same role, such as index.htm or default.html on older Windows hosts, but index.html is the one every host understands. It is also the entry point browsers and crawlers assume when they are given nothing more specific than a domain.
Why It Matters
Get this file wrong and the site has no front door, however good the rest of it is. A folder with no index.html produces one of two unhelpful things: a directory listing, which exposes every file name you uploaded to anyone who visits, or a 404, which makes a site that is entirely present look entirely missing. Both are common right after a first upload, and both are fixed by renaming one file. The listing case is the worse of the two, because draft PDFs, old exports and half-finished pages are then discoverable by anyone who guesses the address. Modern static hosts default to returning 404 rather than listing, which is safer but hides the actual cause.
How It Works
A request for a path with no filename makes the server check for a directory index inside that folder. If index.html exists, it is returned with a 200 status and Content-Type of text/html, and the URL in the address bar stays as the folder path. If it does not exist, the server does one of three things depending on its configuration: generate an HTML listing of the folder's contents, return 404 Not Found, or serve a custom 404 page you supplied. Filenames are matched case-sensitively on Linux hosts, so Index.html and index.HTML are simply different files and neither will be found. Requests that name a file directly, such as /about.html, skip this lookup entirely — the index rule only applies when the path ends at a directory.
Real-World Example
Someone exports a site from a design tool and uploads a folder whose home page is called home.html. On 99helpers the address portfolio-rk.99helpers.site answers with a 404, even though all sixteen files are plainly there under their own names. Renaming home.html to index.html and re-uploading fixes it in one step, and the same rule then gives them /work/ and /contact/ for free once each of those folders has its own index.html. Nothing about the page's content changed — only which file the server was allowed to treat as the default.
Common Mistakes
- ✕Naming the home page home.html, main.html or default.html — the server has no way to guess which of your files is meant to be the front door
- ✕Letting an editor save the file as index.html.txt — the real extension is .txt, so the browser shows the markup as plain text instead of rendering it
- ✕Giving sub-folders no index of their own — /blog/ then 404s or lists its contents while /blog/post-one.html works perfectly
Related Terms
Entry Point
The entry point is the file loaded first when something opens your site — for a web page, the HTML document the browser receives before anything else. Everything else is pulled in because that first file asked for it.
Static Site
A static site is a website made of finished files — HTML, CSS, JavaScript, images — that are sent to the browser exactly as they are stored. Nothing is assembled on the server when a visitor arrives.
Static Hosting
Static hosting is a service that stores a folder of finished web files and serves them over HTTP, without running any application code of yours. You upload the folder; the host answers requests for the files in it.
Custom 404 Page
A custom 404 page is the page a site shows when someone asks for an address that does not exist, written by you rather than left to the host's default. It is returned with a 404 status code.
HTTP Status Code
An HTTP status code is the three-digit number a server returns at the head of every response, saying what happened to the request. It is the first thing on the first line — a 200 means here is the file, a 404 means there is nothing at that address.
Put a file online in seconds
Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.
Host a file free →