The HTTP 404 status code stands for "Not Found". It is a client error response indicating that the requested resource could not be found on the server.

When is HTTP 404 Used?

  • When a user requests a non-existent page or resource.
  • When a URL is mistyped or incorrectly formatted.
  • When a resource has been deleted or moved without a redirect.
  • When an API endpoint is unavailable or does not exist.

Common Causes of HTTP 404 Errors

  • Broken or outdated links (also known as dead links).
  • Typos in URLs entered by the user.
  • Moved or deleted content without setting up a 301 (Permanent Redirect).
  • Dynamic pages no longer generated by a server-side application.

Example Scenarios

  • A user tries to access https://example.com/blog/post123 when post123 has been deleted.
  • An application calls an API endpoint that does not exist.
  • A website migration occurs, and old URLs are not redirected properly.

Example

Client Request (Accessing a Non-Existent Page)

    
        GET /blog/old-post HTTP/1.1
        Host: example.com
    

Server Response (404 Not Found)

    
        HTTP/1.1 404 Not Found
        Content-Type: application/json

        { "error": "The requested resource was not found on this server." }
    

Best Practices for Handling HTTP 404 Errors

  • Custom 404 Pages: Provide a user-friendly error page with navigation links.
  • Redirects: Use 301 redirects if content moves permanently.
  • Monitor Broken Links: Regularly check for dead links to improve user experience.

Summary

HTTP 404 means the requested resource does not exist on the server. It is commonly caused by typos, deleted content, broken links, or missing API endpoints.