Some themes include a custom “404 not found” page when a visitor to your blog tries to request a page that is no longer on the web, or if they mistype a URL. You can override this page in 2 different ways:

  • The easiest way is to create a new page under Posts → Pages. For the title, type “404” and save the page. will notice that special title and automatically set up the page filename to be /404.html. You can later edit the title or text content to anything you want.
  • If you need more control, use a custom theme to add a new template in layouts/404.html. This can use any Hugo includes to show headers, footers, or handle other logic.

When neither of these pages are found, will return a basic “Not Found” page.

Source: Custom 404 page - Help.