How to test 404.html on local server?

I put the layout file in “theme/layouts/404.html” and it is created and i can reach it manually (localhost:1313/404.html - but when a 404 error occurs, it won’t open up my newly created 404 page - but instead the default page with only the “404 page not found” string.

Is threre a setting in the config file i could set or something?

Besides this, i want to use the “slash at the end” syntax all over my pages because many search engines prefer that.
so i created a file in


is it possible to set the generated


as the 404 page?

one more question:
Is it possible to catch 50* Errors with hugo? Or would i just have to create a page and set it manuall in my server specific settings?

thank you guys :slight_smile:

  1. The Hugo built-in server doesn’t seem to support this. It should, I’ll create an issue.
  2. As to /404/index.html - this is how it is generated by default if you haven’t set uglyurls=true in the config (or, it’s created twice - once on root and secondly under /404/index.html).
  3. As to 50* errors, see 1) Hugo server has no specific error handling. The internal 404.html template was added because it’s the default error page in GitHub pages - and it’s “the only” HTTP error you shold get from your static site.


But if you’re not using the built in server in production, just pointing the browser directly at the page should be “as good a test”.