404 Not Found
The 404 (Not Found) HTTP status code indicates the server does not have a document matching the request URI.
This is a 4xx client error because it is typically generated for clients who fill out URI templates (such as HTML forms) with names that do not exist. It might be a server error if the record is merely missing, and needs to be restored, as is the case with broken links.
Writing responses (servers)
This status code is used when the resource does not exist, and the request method requires the resource to exist. This typically includes safe methods like GET, HEAD, and OPTIONS; as well as methods like POST.
The response should include a document describing that the requested page was not found. You may wish to provide a way to report broken links to the webmaster.
This status can also be used when disclosing the existence of a resource could be a security or privacy problem. If used for this purpose, authorization should be tested immediately after the resource is dereferenced. Take care that the behavior is identical to a "real" 404 response, and consider timing attacks.
Servers may wish to log this error along with the request Referer header, if it exists, which can be used to fix broken links.
If the resource has merely been deleted (for example, a "deleted" flag on the database record is set), then see 410 Gone instead.
Servers may wish to give users the opportunity to create the resource, for example, on wikis. If the request is for a URI used on another page, the server should provide instructions on how to create the resource, using a rel=create-form
link, and should advertise the ability for clients to create the resource directly using an Allow: PUT
header.
The exact contents of this error may vary by the URI, and the namespace that the URI falls under. This may include information for technical support, or setting the theme to be consistent with adjacent pages that do exist. For example, a request to http://example.com/product/foobar
may mention that the server tried to look up a product, but did not find anything with that product ID "foobar".
Reading responses (clients)
A 404 Not Found
or 410 Gone
response indicates that the resource was not found on the server. In contrast, a 2xx response implies the resource does exist; any other status code is indeterminate.
If the client found this resource from a link on another page, it may be an invitation for the client to create the resource. Otherwise, the user may want to inform the server operator of a broken link.
If the client generated the URI from a URI template (such as an HTML form), it means the server has not created a resource with the specified parameters yet; the client may try creating the given resource using a PUT request.
Some servers are known to hide the existence of resources until a user is sufficiently authorized to view the resource. If the server is known to require credentials, verify that the credentials work before trying other error recovery options.
Overview table
- Name
- 404
- Message
- 404 Not Found
- Description
- The resource does not exist
- Specification
- RFC 7231: HTTP/1.1 Semantics and Content ยง6.5.4. 404 Not Found