404 Not Found
The web's most famous error is also one of its most misunderstood. A 404 is not a failure to be hidden; it is an honest answer, and the real mistakes are serving it wrongly or not serving it at all.
A 404 is the server saying, "I have nothing for that address." That is often exactly the right answer: someone mistyped a URL, an old link points at a page you deleted, or a bot is probing for /wp-login.php on a site that has never run WordPress. The errors worth fixing are the ones where a 404 hides a real problem, or where a page that does not exist pretends that it does.
What 404 means, precisely#
RFC 9110 §15.5.5 says a 404 "indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists." Two details in that sentence matter:
- "Current representation." The resource might exist later, or might have existed before. A 404 makes no claim either way. The RFC states that it "does not indicate whether this lack of representation is temporary or permanent."
- "Not willing to disclose." A 404 can be a deliberate privacy choice. RFC 9110's 403 section explicitly allows a server to answer 404 to "hide" a forbidden resource. GitHub documents that its API returns 404 rather than 403 "to avoid confirming the existence of private repositories."
The RFC also notes that a 404 is heuristically cacheable, so a CDN or browser may keep serving a 404 for a while after you publish the missing page. If a freshly created page still 404s, purge the cache before you start debugging routes.
404 vs 410 Gone#
RFC 9110 §15.5.11 defines 410 as "no longer available at the origin server" with a condition that "is likely to be permanent." It describes the purpose as helping web maintenance by signalling that the resource is "intentionally unavailable" and that the owners want links to it removed, giving limited-time promotions and departed staff pages as examples.
404 Not Found | 410 Gone | |
|---|---|---|
| Claim | Nothing here (now), or not telling | It was here, it is gone on purpose |
| Permanence | Unspecified | Likely permanent |
| Use when | Unknown URLs, typos, or you are unsure | You deliberately removed it and there is no replacement |
| Google Search | Removed from the index | Removed from the index; Google documents no different treatment |
On that last row: Google's status-code documentation groups all 4xx codes except 429 together, saying indexed URLs returning them are removed from the index. It does not promise that 410 is processed faster. Use 410 because it is more truthful, not as an SEO trick.
Soft 404s: the real mistake#
A soft 404 is a page that looks like an error to a human but returns 200 OK. Google's troubleshooting guide describes it as a URL "that returns a page telling the user that the page does not exist," and Search Console reports these as soft 404 errors.
HTTP/1.1 200 OK … <h1>Sorry, we couldn't find that page</h1>
HTTP/1.1 404 Not Found … the same friendly page, search box and links
Your custom error page can be as helpful and charming as you like. It just has to be served with the right status code.
Google's guide lists three fixes, depending on the situation:
| Situation | Google's recommended response |
|---|---|
| Page removed, no similar replacement | Return 404 or 410 |
| Page moved, or has a clear replacement | Return a 301 to the replacement |
| Page is fine but was flagged anyway | It probably did not render properly for Googlebot (missing resources, an error message shown during rendering). Check it with the URL Inspection tool. |
The same guide lists causes such as "a missing server-side include file," "a broken connection to the database," and "an unloaded or otherwise missing JavaScript file." In other words, some soft 404s are really failed server responses wearing a 200.
Single-page apps#
Client-side routers are a classic source of soft 404s. The server returns index.html with a 200 for every path, then JavaScript renders a "not found" view. Options, from most to least robust:
- Let the server know the valid routes and return a real 404 for anything else (server-side rendering or a route manifest).
- For static hosting, only fall back to
index.htmlfor known route prefixes, and serve a static404.htmlwith a 404 status for everything else. - If neither is possible, have the not-found view add
<meta name="robots" content="noindex">so the empty shell is not indexed.
# nginx: static site with clean URLs and an honest 404
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
In nginx, error_page serves your custom page while keeping the 404 status. Be careful with the variant error_page 404 =200 /404.html;, which deliberately changes the status to 200 and creates a soft 404.
Common causes of a 404#
| Cause | Typical sign | Fix |
|---|---|---|
| Typo in a link or URL | One-off misses in logs | Fix the link; consider suggestions on the 404 page |
| Page deleted or renamed without a redirect | 404s that start the day of a redesign or migration | Add 301s from old URLs to their replacements |
| Case sensitivity | Works on macOS, 404s on Linux | Lowercase URLs and file names consistently |
| Trailing slash mismatch | /about works, /about/ does not (or vice versa) | Pick one form and redirect the other |
| Wrong route or HTTP method in an API | POST /users/ vs POST /users | Check the router; a wrong method should be 405, not 404 |
| Deployment missed files | Assets or new pages 404 right after deploy | Compare the build output with what is on the server |
| Stale cached 404 | Origin returns 200, users still see 404 | Purge the CDN/browser cache |
| Vulnerability scanners | Bursts of requests for .env, wp-admin, phpmyadmin | Nothing; these 404s are correct |
How to debug#
# What status does the URL really return?
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/pricing
# Check the old URL redirects where you think it does
curl -sIL https://example.com/old-pricing | grep -iE "^(HTTP|location)"
# Top 404 paths in an nginx access log (combined format: status is field 9)
awk '$9 == 404 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
The log query is the most useful of the three. A list of the most frequently requested missing paths tells you which redirects are worth adding; one-off misses usually are not. Search Console's Page indexing report gives you the same view from Google's side.
If you are a visitor#
- Check the URL for typos, stray punctuation, or an extra word pasted at the end.
- Remove parts of the path from the right until you reach a page that exists, then navigate from there.
- Use the site's own search, or a search engine with
site:example.comand a few keywords. - Try the Internet Archive's Wayback Machine for pages that have genuinely disappeared.
A good 404 page#
The status code is for machines; the page is for people. A useful 404 page says plainly that the page is not here, keeps your normal navigation, offers search, and links to the most popular sections. It should be lightweight and must not itself depend on the thing that might be broken. Our own 404 page has a little fun with the idea of an erroneous URL, which is also allowed.
Frequently asked questions
What does a 404 error mean?
RFC 9110 says the origin server did not find a current representation for the target resource, or is not willing to disclose that one exists. It says nothing about whether the condition is temporary or permanent.
What is the difference between 404 and 410?
410 Gone means the resource is intentionally unavailable and the condition is likely permanent. RFC 9110 says 410 is preferred over 404 when the server knows the removal is permanent; if it does not know, 404 should be used.
What is a soft 404?
A page that tells the visitor it does not exist (or is empty) but returns a 2xx success status. Google detects these and reports them as soft 404 errors in Search Console. Fix it by returning a real 404 or 410, or a 301 if there is a genuine replacement.
Do 404 errors hurt my SEO?
Google says 4xx codes other than 429 do not affect crawl rate, and that indexed URLs returning 4xx are removed from the index. Missing pages that should not exist are normal; the problem is losing pages that should exist, or links that point to them.
Should I redirect all 404s to the homepage?
No. Google's guidance is to return 404 or 410 when a page is gone with no replacement and to use a 301 only when there is a clear replacement. Mass redirects to the homepage tend to be treated as soft 404s and confuse visitors.
Sources
Every factual claim on this page links to one of these. Checked October 2026. See how we source.
- RFC 9110 §15.5.5: 404 Not Found rfc-editor.org
- RFC 9110 §15.5.11: 410 Gone rfc-editor.org
- RFC 9110 §15.5.4: 403 Forbidden (hiding a resource with 404) rfc-editor.org
- Google Search Central: How HTTP status codes affect Google Search developers.google.com
- Google Search Central: Troubleshoot crawling errors (soft 404s) developers.google.com
- MDN: 404 Not Found developer.mozilla.org
- GitHub Docs: Troubleshooting the REST API docs.github.com
- nginx: ngx_http_core_module (try_files, error_page) nginx.org