Agent Wranglers

Redirects and canonicals Recommended

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.

Example

HTTP/2 410
content-type: text/html; charset=utf-8
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.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/redirects-and-canonicals/gone-pages.