HTTP 404 Not Found means the server could not find anything to serve at the URL you asked for. It is defined in RFC 9110, section 15.5.5. The server is working, and it understood the request; the problem is the address or the missing resource. A server may also use 404 on purpose, to avoid telling you that a protected resource exists.
The usual causes
- A typo or an old link: the URL was copied wrongly, or the page moved and nothing redirects the old address.
- A wrong base path: the app lives under
/app/but a link or an asset points at/. - Case:
/Docs/Intro.htmland/docs/intro.htmlare two different files on a Linux server. - A trailing slash: some servers treat
/guideand/guide/as different, and a static host may only have the folder version. - The file was never deployed: it is ignored by git, excluded by the build, or the build output is in another folder.
- Single-page app routing: the browser handles
/settingsin JavaScript, but a refresh sends that path to the server, which has no such file. The server needs a rule that returnsindex.htmlfor application routes. - A routing rule in the framework: a route was not registered, or an
iffell through to the default.
Debug a 404 in three steps
- Look at the exact request, not at what you meant to type. Paste the URL into the URL parser to see the path, the query and the fragment separately, and any
%20or double encoding in the path. - Request it from a terminal:
curl -i https://example.com/missingshows the real status, the headers and the body, without the browser’s cache. Add-Lto follow redirects and see which hop ends in 404. - Check the server’s log: nginx and Apache write the file path they looked for. If the path is not what you expected, the problem is in the configuration (
root,alias, rewrite rules), not in the page.
What to return instead of a plain 404
| Situation | Use |
|---|---|
| The page never existed, or you do not know | 404 |
| The page was removed on purpose and will not come back | 410 Gone |
| The page moved | a redirect, 301 for a permanent move |
| The user may not see it, and you want to hide that it exists | 404 instead of 403 |
Make your 404 page useful, and correct
Send the status 404 along with the page. A friendly page that answers 200 is a soft 404 and confuses crawlers. On the page itself, keep the site header, add a search box or links to the main sections, and say what the visitor can do next. For static hosting, name the file 404.html in the location the host expects.
Remember that API clients read the status first. A JSON API should return 404 with a JSON body such as {"error":"user_not_found"}, not an HTML page.
Related codes
Search 404 and 410 together in the HTTP status codes tool to compare them side by side. Authentication problems are a different family: see 401 and 403.
Frequently asked questions
What is the difference between 404 and 410?
404 says there is nothing here now, and says nothing about later. 410 says the page existed and was removed on purpose, for good. Search engines drop a 410 URL slightly faster, so use it for content you really deleted.
What is a soft 404?
A page that shows 'not found' text but returns status 200. Search engines see a normal page and may index it. Always send the 404 status together with the not-found page; a single-page app needs the server or CDN to do that.
Do 404 errors hurt my search ranking?
A 404 for a URL that should not exist is normal and does no harm. It becomes a problem when pages that used to rank return 404 without a redirect, or when your own internal links point at missing pages.
Why does a URL work on my laptop and give 404 on the server?
Linux servers treat file names as case sensitive, and macOS and Windows usually do not, so Logo.PNG and logo.png are different files there. Another cause is a file that was not part of the deploy or a path that depends on the folder you started from.
More in this reference
- HTTP 301 Moved Permanently: redirects, caching and SEO
- HTTP 302 Found: temporary redirects, and when to use 303 or 307 instead
- HTTP 304 Not Modified: how conditional requests and ETags save bandwidth
- HTTP 400 Bad Request: the common causes and how to find the bad part
- HTTP 401 Unauthorized: missing or invalid credentials, and 401 vs 403
- HTTP 403 Forbidden: why access is refused and how to fix it
- HTTP 429 Too Many Requests: what it means and how to handle it
- HTTP 500 Internal Server Error: how to find the cause and what to tell users
- HTTP 502 Bad Gateway: finding the broken link between the proxy and the app
- HTTP 503 Service Unavailable: maintenance pages, overload and Retry-After
- HTTP 504 Gateway Timeout: why the proxy gave up waiting, and the timeouts to check