Naar de hoofdinhoud
EnglishEN EspañolES FrançaisFR DeutschDE ItalianoIT PortuguêsPT 中文ZH 日本語JA 한국어KO РусскийRU NederlandsNL
← Back to all articles

Dit artikel is voorlopig alleen in het Engels beschikbaar.

Custom 404 Pages That Keep Visitors (and Avoid Soft 404s)

Every website has missing pages. Someone mistypes a URL, an old link in an email points to a page you renamed, or a service you no longer offer still sits in a bookmark. When that happens, the server answers with a 404 status, and what the visitor sees next decides whether they keep looking around or close the tab.

A good custom 404 page fixes the visitor side. The status code fixes the search engine side. The trouble is that many sites get one right and break the other: a friendly "page not found" message that the server reports as a normal, successful page. Google calls that a soft 404. This guide covers what a 404 page should say, how to make sure it returns the right status, when to use 410 or a redirect instead, and how to check your own site.

Key facts

  • 404 — Not Found: the server can't find the requested page
  • 410 — Gone: the page has been removed and isn't coming back
  • 200 — Success: the status a "not found" page should never send, or it becomes a soft 404
  • 0 — Effect of 404s on Google's crawl rate (only 429 among 4xx codes slows crawling)

What a 404 Really Tells Browsers and Google

MDN defines 404 Not Found as a status that "indicates that the server cannot find the requested resource." It says nothing about whether the page is gone for good. If you know a page has been permanently removed, MDN says servers should send 410 Gone instead, and if you're not sure, a 404 is the safe choice.

Google's crawler documentation explains what happens next. Google doesn't index URLs that return a 4xx status, and URLs that were already indexed and now return one are removed from the index. For 404 and 410, Google says it will gradually crawl those URLs less often. It also states that 4xx codes, apart from 429, have no effect on crawl rate.

Are 404s bad for SEO?

Not on their own. A missing page dropping out of the index is the correct result. Google's Page indexing report help says, "In general, we recommend fixing only 404 errors that you link to yourself or list in a sitemap." A 404 for a page that never existed, or one you deliberately removed, is normal. The ones worth fixing are broken links you control and pages that moved without a redirect.

Soft 404s: The Friendly Page That Lies

Google's crawling troubleshooting guide describes a soft 404 as a URL that returns a page telling the user the page doesn't exist, along with a 200 (success) status code. To a person it looks like an error page. To a crawler it looks like a real page whose content is "Sorry, not found."

Soft 404s usually come from setups like these:

  • Catch-all rules that send every unknown URL to a page template, which then prints "not found" but never sets the status.
  • Redirecting every missing page to the homepage. Visitors land somewhere unexpected with no explanation, and the original URL never reports that it's missing.
  • Empty search or category pages that load fine but have nothing on them.
  • Single-page apps where the server returns the same HTML shell with a 200 for every path and JavaScript decides what to show.

How Google says to fix them

The same guide gives three options depending on what happened to the page:

  1. If the page and its content are gone, return a 404 or 410 status.
  2. If the content moved to a new URL, return a 301 permanent redirect to it.
  3. If the page still exists and is being flagged by mistake, use the URL Inspection tool in Search Console to see how Google renders it. Thin or broken-looking content can be mistaken for an error page.

What to Put on a Custom 404 Page

Google's guide says that "a good custom 404 page helps people find the information they're looking for," and it is clear that custom 404 pages are created for users, not for search engines. MDN agrees, with one caveat: custom 404 design "is a good thing in moderation." A clever illustration is fine, but the page has one job, which is getting the visitor back on track.

Based on Google's suggestions, a useful 404 page should:

  • Say clearly that the page can't be found. Plain words like "We can't find that page" beat jokes or error codes on their own.
  • Look like the rest of your site. Keep the normal header, navigation and footer so the visitor knows they're still in the right place.
  • Link to the pages people most likely wanted. For a service business that usually means the homepage, your main services, pricing and the contact page.
  • Offer a way to report the broken link. A short line with your email or a link to the contact form is enough.

A site search box helps if your site is large enough to need one. Keep the page fast and light: it's often seen by people who were already a little lost.

What to leave off

Avoid automatic redirects after a few seconds, pop-ups and anything that hides the navigation. Don't send visitors to the homepage without explaining why they're there, because that is confusing and hides the fact that the link is broken.

Making Sure the Page Returns a Real 404

The design is the easy part. The status code is where most mistakes happen, so set it up deliberately for your platform.

Apache and .htaccess

On Apache hosting, including most shared hosting, the ErrorDocument directive tells the server which page to show for an error. MDN's example is a single line in .htaccess:

ErrorDocument 404 /notfound.html

The path matters. Apache's documentation explains that a local path starting with a slash is served internally and keeps the original status. If you write a full URL such as https://example.com/notfound.html instead, Apache sends a redirect to that URL and the client "will not receive the original error status code." That one detail turns a correct 404 into a redirect to a page that returns 200.

PHP and custom templates

If a script decides that a page doesn't exist, it must send the status before any output, for example with http_response_code(404); in PHP, and then print the error template. Printing a "not found" message without setting the code is exactly how soft 404s are born.

WordPress and site builders

WordPress themes normally include a 404.php template that WordPress serves with a 404 status. Problems start when a plugin redirects all missing pages to the homepage. Hosted builders usually handle the status for you and let you edit the 404 page's content, but check rather than assume.

Single-page apps

Google's JavaScript SEO guide acknowledges that meaningful status codes can be impractical in client-rendered apps. It suggests either a JavaScript redirect to a URL that does return 404 from the server (such as /not-found), or adding <meta name="robots" content="noindex"> to error views with JavaScript.

404, 410 or Redirect? Choosing the Right Response

When a page goes away, decide what actually happened to it:

  • It moved, or there is a clear replacement: use a 301 redirect to the new page. Google's Page indexing help says, "If a page has been moved, you should return a 3XX redirect to the new page."
  • It's gone for good and nothing replaces it: a 410 says so explicitly. MDN notes a 410 is cacheable by default, so only use it when you're sure.
  • It's missing and you're not sure why, or it never existed: return a 404 with your helpful custom page.

Don't redirect a retired page to a loosely related one just to avoid a 404. If the new page doesn't answer what the visitor came for, an honest 404 with good links is a better experience, and it keeps your redirects meaningful.

How to Check and Monitor 404s

  1. Test a made-up URL. Visit something like /this-page-does-not-exist-123/ on your site. You should see your custom page. Then confirm the status: in Chrome DevTools, open the Network tab and reload, or run curl -I https://yourdomain.com/this-page-does-not-exist-123/. The first line should show 404, not 200 or 301.
  2. Check Search Console. The Page indexing report lists URLs Google found that return 404 and URLs it flagged as soft 404. Remember Google's own advice that not every unindexed URL is a problem.
  3. Fix the 404s you caused. Look for broken internal links in menus, footers and old blog posts, and remove missing pages from your XML sitemap.
  4. Add redirects for moved pages that still get visits or have links from other sites.
  5. Re-test after changes to themes, plugins, hosting or your CDN, since any of them can change how missing pages are handled.

Sources

Related reading

Frequently asked questions

Do 404 errors hurt my rankings?

Not by themselves. Google removes URLs that return 404 from its index and crawls them less often, and it says 404s don't affect crawl rate. Google recommends fixing only the 404s you link to yourself or list in a sitemap.

Should I redirect all missing pages to my homepage?

No. It confuses visitors and hides broken links you could otherwise find and fix. Redirect a page only when there is a real replacement; otherwise return a 404 with a helpful custom page.

What is the difference between 404 and 410?

A 404 only says the page can't be found. A 410 says it has been removed and the condition is likely permanent. MDN advises using 404 when you're not sure which applies.

Want a 404 page that actually helps?

Tell me about your site and I'll send a free, no-obligation quote for a clean technical SEO setup, error pages and redirects included.

Get a free quote