Home » Website Errors » 404 Not Found: Track Down Missing Pages and Send Visitors Somewhere Useful
404 Not Found: Track Down Missing Pages and Send Visitors Somewhere Useful
A 404 is the server saying, plainly, "I looked and there is nothing at this address." The server itself is fine. The request reached it, it checked, and no file or route matched. That makes 404s one of the easier errors to fix, as long as you work out where the bad address came from.
Why pages go missing
Almost every 404 has one of these origins:
- The page was deleted or unpublished and nothing replaced it.
- The URL changed. A renamed slug, a new permalink format, or a site move to a new folder all break old addresses.
- Someone linked to it wrongly. A typo in a menu, a post, an email campaign, or another website.
- Case or trailing characters. On Linux servers
/Aboutand/aboutare different files. A stray.or)copied with a link also produces a 404. - Rewrite rules are missing. CMS sites route pretty URLs through a rewrite file. If
.htaccessor the nginxtry_filesrule is gone, every page except the homepage returns 404.
That last one is worth checking first if all inner pages fail at once. It is a configuration problem, not a content problem.
Step 1: confirm the status code
Browsers show friendly pages that hide the real status. Check what the server actually sends:
curl -sI https://example.com/old-page
The first line should read HTTP/2 404. If it says 200 while showing "not found" text, you have a soft 404 (see the FAQ).
Step 2: find the missing URLs
You rarely discover 404s one at a time. Gather them in bulk:
- Google Search Console: Indexing → Pages → "Not found (404)". This lists URLs Google tried and failed.
- Server access logs: search for 404 responses and sort by count.
awk '$9 == 404 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
- A crawler (Screaming Frog, Sitebulb, or a free link checker) shows which of your own pages link to missing ones.
Step 3: decide what each one deserves
Not every 404 needs fixing. Sort them into three piles:
| Situation | Action |
|---|---|
| Page moved or was renamed | 301 redirect old URL to new URL |
| Page deleted but a close replacement exists | 301 redirect to the replacement |
| Page deleted, nothing similar, few visits | Leave it as a 404 (or 410 Gone) |
Junk URLs from bots scanning for /wp-login.php etc. |
Ignore |
| Your own menu or content links to it | Fix the link at the source |
Fixing the link at its source is always better than redirecting. A redirect adds an extra round trip for every visitor forever.
Step 4: add redirects
On Apache, in .htaccess:
Redirect 301 /old-page /new-page
On nginx, inside the server block:
location = /old-page { return 301 /new-page; }
On WordPress, the free Redirection plugin manages these without touching server files, and can log new 404s as they happen.
Step 5: make the 404 page useful
Some visitors will always land on a missing page. Give them a way forward: a short apology, a search box, links to your main sections, and a link home. Keep the 404 status code. A good error page keeps people on the site; a blank "Not Found" line sends them back to the search results.
Common mistakes
- Redirecting everything to the homepage, which hides real problems.
- Changing permalink settings on a live site without redirecting the old URLs.
- Fixing the redirect but leaving the broken link in your own navigation.
- Returning 200 on the custom error page, which creates soft 404s.
Frequently Asked Questions
Do 404 errors hurt my search rankings?
A 404 on a page that never had value does no harm. Search engines expect them. The damage comes when pages that earned links or traffic disappear, because that value is lost unless you redirect the old address to the closest live page.
Should I redirect every 404 to the homepage?
No. Sending unrelated missing pages to the homepage confuses visitors, and search engines often treat it as a 'soft 404' anyway. Redirect only when a genuinely equivalent page exists, and let the rest return a proper 404.
What is a soft 404?
A page that tells visitors the content is missing but answers with a 200 OK status. Search engines may index it as a real page. Make sure your error page returns the 404 status code.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.