404 Not Found
404 Not Found is the HTTP status code a web server returns when the URL that was requested does not match any page, file, endpoint or route the server is able to serve. It sits in the 4xx range, which means the request itself was well-formed and reached the server, but nothing lives at that address. For a visitor it usually appears as a plain “page not found” message; for a site owner it is a signal that a link is broken, a page was moved without a redirect, or content was removed.
What it means
When a browser requests a URL, the server looks for a resource that matches it. If nothing matches, the correct response is a 404 status together with a short explanation page. The code is deliberately distinct from 410 Gone, which says the resource was removed on purpose, and from 403 Forbidden, where the resource exists but access is denied. A 404 says simply: there is no such resource at this address.
Two situations are often confused. A hard 404 returns the status code 404 along with a not-found page. A soft 404 returns a page that looks like “not found” but sends an HTTP 200 OK status, telling search engines the request succeeded. Returning the correct status matters, because crawlers and users both rely on it to know whether a URL is real.
The status is decided by the server, not the browser, which is why the same missing page can look different across sites. A well-built server sends 404 for anything it cannot serve, including images, scripts and API endpoints, not just HTML documents. When a browser meets a missing image or stylesheet it often fails silently, so visitors notice that the page looks broken rather than reading an error message.
Common causes
- A page, post or file was deleted or renamed without a redirect being left behind.
- A typo or stale link points at a URL that never existed, or the site's internal links are outdated.
- A redirect chain ends at a missing target, or a rewrite rule sends the request to the wrong path.
- Case or trailing-slash differences: on case-sensitive servers,
/Aboutand/aboutare different resources. - Content was moved to a subdomain or a new URL structure, leaving the old paths empty.
How to fix it
For a visitor there is little to fix beyond re-checking the address; for a site owner the job is to find the broken URL and give it a home again.
- Confirm the real status. Check the response code rather than the look of the page:
The first line should readcurl -I https://example.com/old-pageHTTP/2 404when something is genuinely missing. - Redirect moved content. Point the old URL at its new home with a permanent redirect. In nginx:
location = /old-page { return 301 /new-page; } - Fix internal links. Search your templates and content for the broken path and update every menu, button and article that still points to it.
- Serve a useful 404 page. Keep a custom error document that returns the 404 status and offers search or links to popular pages, instead of a bare server default.
- Watch for soft 404s. Make sure your CMS returns a real 404, not a 200, for missing pages, so search engines stay accurate.
Test each change as you make it. After adding a redirect, request the old URL again and confirm it answers with a single 301 that lands on a working page, not a chain that loops or dead-ends. A redirect pointing at another missing URL simply moves the 404 one step further along.
How to prevent it
Plan a redirect whenever you rename or move a page, and keep it in place rather than deleting it later. Publish a sitemap and monitor your server logs or a crawler for 404s so you catch broken links early. Use canonical tags that point at the single true URL for each page, so duplicates do not scatter your links and dilute what search engines index. If a page is gone for good, sending 410 Gone instead of 404 helps crawlers drop it faster.
On case-sensitive hosts, pick one consistent URL style and avoid relying on redirects between /page and /page/ where you can. A little discipline in naming URLs and keeping redirects tidy makes this error rare and, when it does appear, quick to trace back to a single broken link.