404

Not Found

4xx · Client Error common

Overview

404 Not Found is the best-known status code, indicating the server cannot find the requested resource. The URL reached the server, but no resource exists at that path.

Broken links, deleted pages, and mistyped URLs are common causes, and servers sometimes deliberately return 404 instead of 403 to hide whether a resource exists.

When it happens

Request / Response example

Request
GET /articles/this-does-not-exist HTTP/1.1
Host: example.com
Response
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8

<!doctype html><h1>404 Not Found</h1><p>The page you requested could not be found.</p>

In code

// after all routes:
app.use((req, res) => {
  res.status(404).send('Not found');
});
@app.errorhandler(404)
def not_found(e):
    return {'error': 'not_found'}, 404

Common causes

How to fix

Notes

Related status codes

Specification