Agent Wranglers

WEB-83Recommended

Answer 404 or 410 when a page is gone for good

Answer unknown addresses and content removed with no replacement with 404 or 410 and a helpful page. Never show "not found" with a 200, and never send unknown pages to the home page.

How to do it

Use 410 to say the removal is on purpose, and keep it in the redirect map so nobody adds the address back by mistake. Google treats all 4xx answers except 429 the same way, so 404 is fine too. Show the site's navigation and a way to search or go home. Build that page as Make error pages helpful and honest says.

Examples

HTTP example

HTTP/2 410
content-type: text/html; charset=utf-8

nginx example

error_page 404 /404.html;
location / {
  try_files $uri $uri.html $uri/ =404;
}

How to check

Request a removed address and a made-up one, such as curl -s -o /dev/null -w '%{http_code}' https://example.com/no-such-page. Each answers 404 or 410, never 200 and never a redirect to the home page.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/redirects-and-canonicals/gone-pages">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.