What is HTTP Response Status Code 404 Not Found?
HTTP response status code 404 Not Found indicates that the server could not find the requested resource. It means that the URL does not match any resource on the server.
When is HTTP Response Status Code 404 Not Found Used?
The 404 status code is used when the client requests a resource that does not exist or has been removed from the server.
Example 1: Requesting a Nonexistent Page
# Client sends a GET request for a page that doesn't exist. GET /nonexistent-page HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 404 Not Found Date: Wed, 09 Oct 2024 14:25:00 GMT Server: Apache/2.4.41 (Ubuntu) { "error": "The requested page does not exist." }
Example 2: API Endpoint Not Found
# Client sends a request to a nonexistent API endpoint. GET /api/v2/data HTTP/1.1 Host: api.example.com # Server Response HTTP/1.1 404 Not Found Date: Wed, 09 Oct 2024 14:27:00 GMT Server: Nginx/1.18.0 { "error": "The requested API endpoint was not found." }
Summary
The HTTP 404 Not Found status code is used when a requested resource cannot be found on the server. It is one of the most common status codes and often used for missing pages or deleted content.