404 Page Optimization — Finding and Fixing the Dead Ends on Your Site
Every site has broken links. Learn how to find the 404 errors real visitors hit, trace where they came from, fix the source, and design an error page that keeps people on your site.
Short answer: find the 404s that real visitors actually reach, ranked by how often, and trace each to its source: a broken internal link, an old URL from before a redesign, a mistyped campaign link, or an outdated external link. Fix internal links, redirect old URLs to the nearest relevant page, and make your error page helpful, with search, popular links, and a way home.
Table of Contents
- Why 404s Matter
- Finding the Ones That Count
- Tracing the Source
- Fixing Them
- A 404 Page That Helps
- Key Takeaways
Why 404s Matter
- A visitor who meets an error page usually leaves.
- A broken link in a paid campaign wastes every click.
- Links from other sites to a missing page lose their value.
- An error page during checkout or signup ends a conversion.
Not all 404s matter equally. A bot requesting random URLs is noise. A customer clicking a link in your own email and landing on nothing is a fault.
Finding the Ones That Count
| Source | What it shows |
|---|---|
| Analytics, filtered to your 404 page | 404s real visitors hit |
| Server or CDN logs | Every 404, including bots |
| Search Console | URLs search engines failed to fetch |
| A site crawler | Broken internal links |
Start with the first. To make it work, your error page needs to be identifiable, for example by a custom event:
// on your 404 template
deepsync("track", "page_not_found");The session then carries the requested URL as its page and the referrer or previous page, which tells you what was requested and how the visitor got there.
Rank by number of sessions. The top ten usually account for most of the damage.
Tracing the Source
For each frequent 404, ask where the visitor came from.
| Origin | Likely cause |
|---|---|
| Another page on your site | A broken internal link |
| Search engine | An old URL still indexed |
| An email or ad | A mistyped link in the campaign |
| Another website | An outdated external link |
| No referrer | A bookmark, or a typed address |
| After a redesign or migration | URL structure changed without redirects |
Watching a few sessions shows the context: which link was clicked, on which page. In a session recording you can see the click that led to the error.
Two technical causes are worth checking:
- Trailing slash and case differences.
/Pricingand/pricing/may not resolve to the same page (trailing slash issues). - Single-page apps that show a "not found" screen while returning a success status. These are invisible to server logs and need the client-side event above.
Fixing Them
- Internal links: correct the link at its source.
- Moved pages: add a permanent redirect to the new address.
- Removed pages: redirect to the closest relevant page, not blindly to the homepage.
- Campaign links: fix the link and redirect the mistyped URL so clicks already sent still work.
- External links: redirect on your side, and ask the other site to update if it is valuable.
- Genuinely gone, nothing related: leave it as a 404. That is the correct response.
Before any migration or URL restructure, map old addresses to new ones and put redirects in place at launch. Most 404 problems begin on migration day.
A 404 Page That Helps
Some errors are unavoidable. Make the page useful.
- Say what happened in plain words.
- Keep your normal header and navigation.
- Offer search.
- Link to popular pages or categories.
- Give a way to report the problem.
- Match your site's style, so the visitor knows they are in the right place.
- Return a real 404 status, so search engines understand.
- Keep analytics on it, so you can see what happens next.
Then measure: of sessions that reach the 404 page, what share continue to another page? If nearly all leave, the page is not helping.
Check your error page after every release
Request a URL that does not exist and confirm you get a helpful page with a 404 status. Error pages break quietly.
Key Takeaways
- Rank 404s by real visitor sessions.
- Trace each to its source and fix it there.
- Redirect moved pages to the closest relevant page.
- Make the error page a route back into the site.
Conclusion
A 404 is a visitor who wanted something from you and met a wall. Find the walls your real visitors hit, and take them down in order.
Frequently Asked Questions
Related articles
Stay in the loop
Get the latest insights on product analytics and user behavior delivered to your inbox.



