404 Not Found
Description
The 404 Not Found
status code indicates that the server cannot find the requested resource. This status code is one of the most well-known HTTP status codes and is returned when a server cannot locate the resource at the URL provided by the client.
This status code is commonly used when: - The requested URL does not exist on the server - A resource has been removed or deleted - A resource has been moved without a redirect being set up - A URL has been mistyped by the user - A link points to a resource that no longer exists
The 404 Not Found
status does not indicate whether the resource is temporarily or permanently unavailable. It simply states that the server could not find anything at the requested URL at the time of the request.
Syntax
The server responds with a 404 Not Found
status and typically includes an explanation:
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: [length in bytes]
[Response body explaining that the resource was not found]
Examples
Basic Web Page Example
A client requests a page that doesn't exist:
Client Request:
Server Response:
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 285
<!DOCTYPE html>
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
<p>The page you are looking for does not exist.</p>
<p>Please check the URL or return to the <a href="/">homepage</a>.</p>
</body>
</html>
API Resource Example
A client requests an API resource that doesn't exist:
Client Request:
Server Response:
HTTP/1.1 404 Not Found
Content-Type: application/json
Content-Length: 93
{
"error": "Not Found",
"message": "Product with ID 9999 could not be found"
}
Static Asset Example
A client requests an image file that doesn't exist:
Client Request:
Server Response:
Summary
The 404 Not Found
status code is one of the most common and recognizable HTTP error responses. It clearly communicates to clients that the requested resource could not be located on the server. While it can indicate a broken link or mistyped URL, it doesn't provide information about whether the resource might be available in the future or was available in the past. Many websites customize their 404 pages to provide helpful navigation options, search functionality, or even humor to improve user experience when visitors encounter missing resources.