Web operations guide

Designing a 404 error page: HTTP status, navigation, and testing

A good 404 page does not make a missing URL look like a successful page. It returns the correct server status while giving users useful next steps. This guide explains the decisions needed to turn a decorative error message into a page that works in practice.

Published 2025.11.21 Updated 2026.07.25 Written by Finite Field Editorial Team
A person reviewing navigation on a 404 error page
Illustrative photo; it is not evidence of HTTP status or impact on search results.

This article was edited using the HTTP specifications, Google Search Console Help, Google Search documentation, and W3C accessibility materials checked as of July 25, 2026. It does not guarantee improved rankings or bounce rates.

First decision

Determine the URL's destination before designing the page

As a general rule, use a permanent redirect when there is a destination, 404 or 410 for a removed resource without an alternative, and 5xx for a temporary failure. Design the error page after returning the right meaning.

Decision rule

Communicate the URL's actual state through status and help users recover through the page.

What this article helps you decide

Do not treat every 404 as bad. Decide based on each URL's state and the user's situation.

Purpose of 404

Identify missing URLs and give users, crawlers, and operators the information each needs.

Choosing a status

Choose 200, 301/308, 302/307, 404, 410, or 5xx based on what is happening now.

Recovery paths

Offer a few meaningful links such as home, a parent category, or working search.

Verification

Check both status and user experience with curl, browsers, keyboard use, Search Console, and logs.

Six practical considerations

Who is a 404 page for?

A 404 page does more than display an error. Users, search engines, and site operators each need different information from the same response. Considering those needs separately helps identify what the page should include and what it can leave out.

User recovery

Briefly explain that the page was not found and offer next steps. Do not assume a user typo caused the problem.

Example:Explanation + home + parent category

Meaning to crawlers

Even a polished error body sends a found-page signal if it returns 200. Return HTTP 404 or another appropriate status for missing URLs.

Example:HTTP/2 404

Operational diagnosis

Safely record which URLs, referrers, and counts are involved; distinguish broken internal links from external typos.

Example:path, referrer, timestamp

Accessibility

Explain the situation in a heading and make link destinations understandable from context. Do not rely on color alone, and keep keyboard focus visible.

Example:Return to server articles

Protect information

Do not show file paths, stack traces, or internal host names. Always escape an entered URL if displaying it in the body.

Example:Do not expose internal exceptions

Improvement evidence

Focus on top URLs users actually reach and their sources rather than the total 404 count. Recheck under the same conditions after fixing them.

Example:Top URLs by internal referrer

Choose HTTP status based on the URL's state

Choose a status that reflects the resource's current state, not what seems good for SEO. RFC 9110 says 404 indicates no current representation was found without establishing permanence. A known permanent removal can use 410.

200 OK

HTTP/2 200

Return this when the requested page exists normally. Returning 200 for a page that only displays an error can lead to a soft 404 classification.

301・308

Location: /new-url/

Use for a permanent move to a relevant destination serving the same purpose, not to send every deleted URL home.

302・307

Temporary redirect

Use for a temporary move when the original URL is expected to return. Do not leave it indefinitely as a substitute for a permanent move.

404 Not Found

HTTP/2 404

Use when the requested URL has no current representation or its existence is not disclosed. It can be used even when permanence is unknown.

410 Gone

HTTP/2 410

Use when a previously existing resource is unavailable and that state is known to be permanent. Google says it currently treats 410 like 404.

5xx

HTTP/2 503

Temporary inability to serve content because the application or a dependency failed is a server error. Replacing it with 404 falsely signals absence.

Do not confuse 401 and 403 with 404

Normally use 401 when authentication is needed and 403 when access is forbidden. If you use 404 for security to avoid disclosing a resource's existence, make that choice consistently as part of the authorization policy.

When to redirect and when to return 404

Redirects are not a way to hide 404s. Send users directly to a new URL only when it serves substantially the same purpose as the old one. Without an alternative, 404 or 410 better reflects the facts.

Consider a redirect

  • A URL changed and a new URL has the same content.
  • The destination of a consolidation fulfills the old page's main purpose.
  • There is an unambiguous correction for a common URL typo.
  • For a permanent move, 301 or 308 can be selected and each destination managed individually.

Return 404 or 410

  • The page was deleted and no alternative serves the same purpose.
  • The request is for a random or probing URL that never existed.
  • The deletion's permanence is unknown, so 404 reflects the facts.
  • Permanent removal is known and you have a policy to use 410.

Avoid redirecting everything to the home page

Bulk redirects to an unrelated home page or category prevent users from finding their information and may be treated as soft 404s by search engines. Fix broken internal links at the source before adding redirect rules.

Implementing a 404 page

Do not stop at creating a template. Treat routing, status, related data, logs, and tests as one change.

  1. 1

    Classify target URLs

    Classify moved, consolidated, permanently removed, nonexistent, and temporarily unavailable URLs. Check internal links, sitemaps, external referrers, and the relevance of alternatives as well as traffic.

  2. 2

    Render the 404 body with a catch-all

    Render a shared template from the router or web server's unmatched-route handler and return status 404 while preserving the requested URL. Avoid redirecting to /404/ and returning 200.

  3. 3

    Match HEAD and GET status

    Verify that GET returns the body and 404 and HEAD returns the same 404. Serve the CSS, fonts, images, and other assets required by the error page successfully.

  4. 4

    Fix internal links and sitemaps

    Fix internal links to nonexistent URLs and remove those URLs from XML sitemaps. Better navigation on the error page does not fix the source of a broken link.

  5. 5

    Design safe logs

    Record paths, times, referrers, and only necessary User-Agent information; avoid carelessly storing query strings containing searches or tokens. Define retention and access permissions.

  6. 6

    Specify a cache policy

    404 responses may be cached. Do not automatically use identical settings for temporarily delayed content and permanently absent URLs; choose a policy that permits revalidation.

Keep the error template from failing too

If the 404 page strongly depends on a database or external API, an outage may cause another 5xx. Make essential wording and recovery links render without those dependencies.

Test the response and the page

Checking appearance alone can miss a soft 404; checking status alone can miss a page that users cannot navigate. Check URLs, responses, interactions, and monitoring together.

Check status with commands

Check for 404 with curl -I https://example.com/not-found or curl -s -o /dev/null -w '%{http_code}' URL. If redirects occur, record status and Location at each hop.

Compare with known valid URLs

In the same environment, check that normal pages return 200, moved URLs return the intended 301 or 308, and nonexistent URLs return 404. Preserve 5xx during server failures.

Use the page in browsers

In Chrome, Edge, and Safari, check the main heading, home, parent category, and back navigation. At 390px and desktop widths, check for overflow, overlap, and lost focus.

Keyboard and reading order

Verify Tab reaches every link, focus is visible, and the heading, explanation, and main links make sense in order. Make link labels understandable on their own.

Check Search Console

Check Not found and Soft 404 in the page indexing report and inspect representative URLs. Reports contain examples and aggregates, not necessarily a complete list of URLs.

Monitor request sources

Prioritize 404s reached by actual users by URL and referrer. Check whether visits from internal referring pages fall after fixes; do not assert a direct effect on rankings or sales.

Pre-launch stop conditions

Stop publication and fix the issue if a nonexistent URL returns 200, a valid URL returns 404, essential 404-page assets return 404, main links fail, or content overflows horizontally on mobile.

Example: a focused 404 page

This example shows the situation, primary recovery links, related options, and actual status together. A visible 404 label alone is insufficient; the server response must also be 404.

Example: a nonexistent server article URL

404

Page not found

The URL may have changed or the page may have been removed. Find what you need from the home page or server article list.

Return this body with HTTP 404 while preserving the requested URL.

Sources

Specifications and search-engine behavior can change. Check the latest primary sources when implementing.

Frequently asked questions about 404 pages

Do 404 errors lower search rankings?

According to Google, correctly returning 404 for a URL that should not exist normally does not by itself harm site indexing or rankings. Fix inconsistencies such as a page that should exist returning 404, internal links or sitemaps pointing to 404s, or an error body returning 200.

When should I use 404 versus 410?

Use 404 when no current representation is found and permanence is unknown. You can use 410 when a previously existing resource is known to be permanently unavailable. Google says it currently treats 410 like 404.

Should all nonexistent URLs redirect to the home page?

We do not recommend it. Consider 301 or 308 only when a destination serves the same purpose as the old URL. Bulk redirects to an unrelated home page can confuse users and be treated as soft 404s.

Does a 404 page need noindex?

The correct 404 status is the primary signal; do not substitute a 200 response with noindex. Before considering noindex on an error template, verify that missing URLs reliably return 404.

Should a 404 page include site search?

Site search is an option if it actually works and returns useful results. Prefer reliable links such as home or a parent category over a search form you cannot maintain.

Should 404 URLs be blocked in robots.txt?

Blocking nonexistent URLs in robots.txt prevents crawlers from seeing the 404 response. Google also advises returning an appropriate 404 rather than blocking invalid URLs in robots.txt.

Related articles

A 404 page should clearly communicate a URL's status

First classify whether a destination exists and whether removal is permanent, then choose a status. Design a brief explanation and a few recovery paths such as home or a parent category. Finally check status and interaction with commands and real browsers, and maintain internal links, sitemaps, and logs to make the 404 page operational, not merely attractive.

Written and reviewed by

Finite Field Editorial Team

We review primary sources from web operations, server implementation, structured data, and accessibility perspectives, and test the status and display of public pages using reproducible procedures.

Web operations advice

Address 404s, redirects, and internal links together

For URL migrations or many broken links, design redirects, internal links, sitemaps, and monitoring together rather than treating an error page in isolation.

Discuss your situation

After reviewing your request, we will explain the scope and approach.