404 Not Found
The server was reached and understood the request, but it has nothing to return for that URL, or does not want to reveal that something is there.
What 404 means
A 404 is an answer, not a failure to connect: DNS worked, the connection was made and the server read the request. It then found no resource for the path, so the problem is in the URL rather than in the network or the server's health.
The code makes no promise about the future. The page may never have existed, may have moved, or may appear tomorrow. When a server knows that something has been removed for good, 410 Gone says so more precisely.
A 404 can be cached. Unless the response carries its own Cache-Control header, a browser or CDN may reuse it for a while, which is why a page you have just published can keep returning 404 from a cache.
When a server should send it
- No route, file or record matches the path, for example
/orders/8123when order 8123 does not exist. - The resource exists but the caller must not learn that. The HTTP specification allows 404 in place of 403 for exactly this: GitHub answers 404 for private repositories you cannot see.
It is the wrong code when the URL is right but the method is not (405), when the caller only needs to log in (401), or when a search simply has no results: an empty list is a successful answer, so return 200 with [].
Common causes
- A typo or an out-of-date link, bookmark or search result.
- The page moved or was renamed and no redirect was left behind.
- Letter case:
/About.htmland/about.htmlare the same file on Windows and macOS but different files on a Linux server. - A missing rewrite rule. Single-page apps and "pretty" permalinks need the web server to send unknown paths to the application; without that, only the home page works and every deep link is a 404.
- A deploy that left out a file, or a build that put it under a different base path.
- For APIs: the wrong base URL or version prefix (
/v1/against/v2/), or an ID from another environment.
Fixing a 404 as a visitor or API client
- Check the address for typos, then remove the last part of the path and try the level above.
- Use the site's own search, or look the old address up in the Wayback Machine.
- In code, do not retry a 404 in a loop: the same request will get the same answer. Log the full URL you actually sent. Most API 404s turn out to be a doubled slash, a missing version prefix or an unencoded character in an ID, which the URL parser makes easy to see.
- If you created the resource a moment ago and the API reads from a replica, one retry after a short delay is reasonable.
Fixing 404s on your own site
- Find them: your access logs and Google Search Console list the URLs that returned 404, and the
Refererheader shows which page linked there. - Redirect what moved. A 301 from the old address to the closest matching new page keeps links and search rankings. Do not redirect everything to the home page; search engines treat that as a "soft 404".
- Leave a 404 for things that never existed. Requests for
/wp-login.phpon a site that is not WordPress are bots, not broken links. - Make sure the error page really sends status 404. A friendly "not found" page delivered with status 200 is a soft 404 and wastes crawl budget.
- Give the page a way out: a search box and links to the main sections.
404 compared with 410, 403 and 400
| Code | Says | Use it when |
|---|---|---|
| 404 Not Found | Nothing here, no reason given | The path matches nothing, or you want to hide that it does |
| 410 Gone | It was here and has been removed on purpose | You deleted the content and it is not coming back |
| 403 Forbidden | It exists, but you may not have it | Access is refused and there is no harm in saying so |
| 400 Bad Request | The request itself is malformed | The path or parameters cannot be parsed at all |
Example 404 response
HTTP/1.1 404 Not Found
Content-Type: application/json
Content-Length: 55
Cache-Control: no-store
{"error":"not_found","message":"No order with ID 8123"}An API should say what was not found, in a body the client can parse. Cache-Control: no-store stops caches from remembering the 404 if the resource may be created later.
Defined in RFC 9110, section 15.5.5.
Questions
Do 404 errors hurt my search rankings?
Not by themselves. Pages that are missing drop out of the index, but 404s for addresses that should not exist are a normal part of the web and do not count against the rest of the site. What does cost you is a missing page that people still link to: redirect it with a 301 so the links keep their value.
What is a soft 404?
A page that tells the visitor something was not found but is sent with status 200. Search engines have to guess that it is an error page. Send a real 404 status with your custom error page instead.
Is a 404 the client's fault or the server's?
It is in the 4xx class, so formally the request is at fault: it asked for something that is not there. In practice the cause is just as often on the site, such as a moved page with no redirect or a broken rewrite rule.
Why do I get a 404 for a page I just published?
Usually a cached 404 at a CDN or in the browser, a deploy that has not finished, or a route the web server is not passing to the application. Check the response headers for a cache hit, then request the URL directly from the origin.