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.
GET /articles/this-does-not-exist HTTP/1.1
Host: example.comHTTP/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>// 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