Troubleshooting guide
404 Not Found: how to find and fix broken pages
A 404 means the server worked correctly but found nothing at that address. The error is not the problem. A 404 on a page people still reach is.
4 min read10 sectionsUpdated
On this page
When a 404 matters
Every public site gets 404s from bots probing for /wp-admin and old URLs. Those cost nothing. The 404s worth your time are ones reached from your own links, from external sites linking to pages you moved, or from a deployment that dropped a route.
Use 410 Gone rather than 404 when a page was removed deliberately and will not return, as it states your intent more clearly.
Common causes
- A page moved without a redirect after a redesign or CMS migration.
- Case-sensitive paths.
/Aboutand/aboutare different on Linux but the same on a developer's Mac, so the bug appears only in production. - Trailing slash mismatch between the links and the router.
- Missing build assets. A new deployment removed hashed JavaScript files that cached pages still request.
- Reverse proxy path rewriting that strips or adds a prefix.
Find the 404s that matter
Your access log shows which missing URLs get real traffic. Sort by count and look at the referrer to see who is linking there.
# Top missing paths in an Nginx access log
awk '$9 == 404 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
# Where do those requests come from?
awk '$9 == 404 {print $11}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
# Detect a soft 404: a missing URL must not return 200
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/this-does-not-exist-xyzFixes
Redirect moved pages with a 301 to the closest equivalent. Sending every 404 to the home page is treated by Google as a soft 404 and helps nobody. Fix broken internal links at the source, since a redirect hop is a workaround. Keep old hashed assets available for a while after each deployment, so open tabs do not fail. Serve a useful 404 page with search and top links, and make sure it really returns status 404.
Catch it automatically
Add uptime checks on your most valuable pages that verify both the status and a keyword in the body, because a keyword check also catches a soft 404. For assets that vanish after a release, real-user monitoring shows failed resource loads from real browsers. Google Search Console's page indexing report lists what Googlebot could not find.
Do 404 errors hurt SEO?
Not by themselves. Google expects them. They matter when valuable pages with links or traffic disappear without a redirect, or when your own navigation points at them.
Should I redirect all 404s to my home page?
No. Google treats such redirects as soft 404s and visitors land somewhere irrelevant. Redirect only to a truly equivalent page.
What is a soft 404?
A page that says it was not found but returns status 200. Search engines may index it, and monitoring reports it as healthy.
Check it now, free
- Website down checker: Is it down for everyone or just me? Check any site now.
Related reading
- CreateContainerConfigError in Kubernetes: how to fix it: Fix Kubernetes CreateContainerConfigError: missing Secrets and ConfigMaps, wrong keys and namespaces, with kubectl commands that show exactly what is absent.
- 501 Not Implemented: how to fix it: Fix 501 Not Implemented: unsupported HTTP methods, servers and proxies that do not support PATCH or WebDAV, and how it differs from 405 and 500.
- ERR_NAME_NOT_RESOLVED: how to fix DNS lookup failures: Fix ERR_NAME_NOT_RESOLVED: missing records, expired domains, broken resolvers and DNSSEC failures, with dig commands that show exactly where lookup fails.
- 500 Internal Server Error: how to find the cause: A 500 error means your code failed. Find the exception behind it fast with logs, traces and error tracking, and learn how to prevent repeats.
- DNS_PROBE_FINISHED_NXDOMAIN: fix it for your domain: What DNS_PROBE_FINISHED_NXDOMAIN means, how to check your domain and DNS records, the usual causes such as expiry and typos, and how to monitor DNS.
- 405 Method Not Allowed: why it happens and how to fix it: Fix 405 Method Not Allowed: POST sent to a static file, redirects that turn POST into GET, CORS preflights and routing mismatches, with curl checks.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.