More
More
404 Not Found
Nothing exists at this address, or the server will not say that it does.
- Code
404- Reason phrase
- Not Found
- Class
- 4xx Client error
- Defined in
- RFC 9110 section 15.5.5
- Cacheable by default
- Yes
What it means
Client error: the problem lies with the request. Repeating it unchanged will normally fail again.
When a server should send it. When nothing exists at the URL, or the server chooses not to say whether it does. Send a real 404 status with a helpful page (search, links to main sections); a "not found" page served with 200 is a soft 404. Use 410 when you know the page is gone for good.
Common causes. A typo, a deleted or moved page without a redirect, or a broken link.
What to do. Check the address. Site owners should redirect moved pages with 301 and fix internal links.
How clients and crawlers treat it
Browsers and HTTP clients. Browsers show the page the server sends; with no body, they show their own error page. Caches may store a 404 for a while, because it is cacheable by default.
Google Search. Like every 4xx except 429, it tells Google the content does not exist: an indexed URL is removed from the index, and a new one is not processed. Crawl frequency for the URL gradually drops. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Cacheable by default (RFC 9110 section 15.1). With no Cache-Control or Expires header, a cache may still store it and reuse it for a heuristic period, often 10% of the time since Last-Modified, so set Cache-Control explicitly if that is not what you want.
Example response
HTTP/1.1 404 Not Found Content-Type: text/html; charset=utf-8 Not Found
How to send 404
location /example {
return 404;
}
RewriteEngine On RewriteRule ^example$ - [R=404,L]
http_response_code(404); echo 'Not Found'; exit;
res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('Not Found');
# in a view function return 'Not Found', 404
Change the paths to suit. In nginx, add_header needs always to apply to error responses.
Related codes
- 410GoneThe resource was deliberately removed and will not come back.
- 301Moved PermanentlyThe resource has a new permanent address, given in the Location header.
- 403ForbiddenThe server understood the request but refuses it.
- 400Bad RequestThe server could not understand the request.
All status codes · All 4xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.