Understand the idea
A static website serves prepared files rather than building every page from a database at request time. A build step can still generate those files from shared templates.
The browser requests a URL, receives an HTTP response, parses HTML and requests referenced assets. Directory URLs often map to index.html, but the exact mapping belongs to the host. A missing page should return a 404 status as well as a useful message.
Read the example
This is a directory layout, not code to paste into an HTML document.
my-site/
index.html
about/
index.html
assets/
style.css
404.htmlA small mistake, explained
What goes wrong
Returning the home page with status 200 for every unknown URL makes errors look like successful pages.
How to fix it. Configure and test the host’s missing-page behaviour. A file named 404.html alone is not proof that every host will use it correctly.
Try it yourself
Open a known page and a deliberately nonexistent URL. Compare their response status in the Network panel.