Editorial illustration: anatomy of a high-utility 404 page that preserves HTTP status semantics while guiding visitors back to relevant content.
A visitor clicks a link from an old blog post, a WhatsApp message, or a Google search result. Instead of the guide they expected, they hit a blank “404 Not Found” screen with zero navigation and no clue where to go next. Most people don’t edit the URL bar to guess your new folder structure—they hit Back and pick the next search result.
A 404 status code is often the right technical response when a page genuinely does not exist. The mistake is treating the error page as a dead end instead of a recovery point for the visitor and a diagnostic signal for you.
Verify the status code before fixing anything
When someone reports a broken link, don’t just eyeball it in your main browser where service workers or cached redirects might hide the problem. Check the exact HTTP response from the terminal:
curl -sI https://example.com/guides/old-slug | head -n 10
Watch out for two traps. First, soft 404s: single-page apps or misconfigured servers that render a “Page not found” message while returning HTTP/2 200. Search engines hate soft 404s, and uptime monitors won’t flag them. Second, blanket redirects: sending every missing URL to / with a 301 or 302. That hides broken links from your logs and confuses visitors who suddenly land on a generic homepage with no explanation of why the article they clicked vanished.
Check whether the 404 is an isolated typo or a pattern. One random hit to /wp-login.php or /apple-touch-icon-precomposed.png is normal internet background noise. Fifty hits a day to /2024/08/e-invoice-guide/ after a site redesign means you forgot a redirect rule.
Repair internal links first, then redirect deliberately
If the missing URL appears anywhere inside your own codebase, CMS content, footer, or sitemap, fix those internal links directly rather than papering over them with redirects. On a Markdown or static site, a quick rg across blog-src/ or src/ catches typos, missing trailing slashes, or uppercase slug mismatches in seconds.
When external bookmarks or search results still point to an old URL, add a redirect only if a genuine replacement exists. In Nginx, keep direct, single-hop 301 rules rather than chaining old URLs through multiple intermediate paths:
# Direct 301 to the true successor
location = /guides/old-e-invoice-setup/ {
return 301 /blog/malaysia-e-invoice-guide/;
}
# Serve a custom 404 page while preserving the 404 HTTP status
error_page 404 /404.html;
location = /404.html {
internal;
}
If you host on Cloudflare Pages or behind Cloudflare DNS, you can manage these cleanly via _redirects or Cloudflare Bulk Redirects without touching origin server configs. Just avoid redirecting a retired event page from 2023 to a generic “Events” index if the visitor is specifically looking for the 2023 outcome—either keep an archive notice or let it 404 honestly.
Design a 404 page that actually helps
When no true replacement exists, keep the 404 status code and give the visitor a useful page:
- Plain-language message: State clearly that the page moved or no longer exists, without exposing stack traces, server paths, or framework debug output.
- Working navigation and search: Keep your header navigation intact and include a site search box or links to your main sections (e.g.,
/blog/,/projects/,/contact/). - Language awareness: If your site serves both English and Malay routes (for example
/en/...and/ms/...), detect the path prefix so a visitor hitting a broken Malay URL gets recovery links in Malay rather than being dumped onto an English-only fallback. - Mobile-friendly tap targets: Plenty of broken links are clicked from WhatsApp, Telegram, or LinkedIn on a phone. Make sure recovery links aren’t tiny text crammed under a massive SVG illustration.
Test your 404 page after every major migration by hitting a deliberately nonexistent slug, an old URL with a query string (?utm_source=...), and a missing asset path. Confirm the HTTP status stays 404 and the recovery links actually work.
For related guides that complement this checklist, see:
- Your Bug Report Is Not a Conversation: How to Give Developers a Repro They Can Use
- When a Small Website Breaks, a Short Runbook Beats a Long Memory
- A Better Website Search Starts With Better Content Paths