How to Fix a Missing or Unhelpful Custom 404 Page
When a visitor or crawler hits a broken URL on your site, the error page they see often has no way back in: no homepage link, no search box, no navigation. By the end of this guide you will have a custom 404 page with a search form and links to your homepage and most-visited pages, served with a correct 404 HTTP status.

Why it matters
Every broken link, mistyped URL or deleted product sends some visitors to your 404 page. If that page is a dead end, most of them leave, and a crawler following the link finds nothing to continue to. A 404 page with a homepage link, a search box and a few popular links turns that lost visit into a recovered session.
It also keeps the error page from being mistaken for a soft 404 or an empty template. The SEO impact is small, but the fix takes minutes.
What you need
Step-by-step fix
Check what your 404 page shows today
Request a URL that cannot exist and look at both the status code and the page content. The first line of the output should say 404. Then open the same URL in a browser and check whether it shows any links back into the site.
A plain server message such as 'Not Found - nginx' or an empty theme template means this check fails.
curl -sI https://example.com/this-page-does-not-exist-9x7q | head -n 1 curl -s https://example.com/this-page-does-not-exist-9x7q | grep -io '<a [^>]*href="[^"]*"' | head
Pick the popular pages to link to
In GA4, open Reports > Engagement > Pages and screens and sort by Views for the last 90 days. Choose 3-6 pages a lost visitor is most likely to want. Typical picks are main categories, best-selling products, pricing, contact and the blog index.
Skip pages that change often, like time-limited promotions.
Build the 404 page content
Keep your normal site header and footer so the main navigation appears. Then add:
- a clear heading
- one sentence explaining the page wasn't found
- a search form
- a homepage link
- your popular links
Use plain <a href> links in the HTML, not links that only appear after JavaScript runs, so crawlers and audit tools can see them. Match the search form's action and input name to your platform's search URL: /search?q= on Shopify, /?s= on WordPress.
<main class="error-404">
<h1>Sorry, we can't find that page</h1>
<p>The link may be broken or the page may have moved. Try searching, or use one of the links below.</p>
<form action="/search" method="get" role="search">
<label for="q404">Search Example Co</label>
<input id="q404" type="search" name="q" placeholder="Search products and articles">
<button type="submit">Search</button>
</form>
<p><a href="/">Back to the homepage</a></p>
<h2>Popular pages</h2>
<ul>
<li><a href="/shop/">Shop all products</a></li>
<li><a href="/pricing/">Pricing</a></li>
<li><a href="/blog/">Blog</a></li>
<li><a href="/contact/">Contact us</a></li>
</ul>
</main>Serve the page for every missing URL
On a CMS, the 404 template handles this automatically once you edit it (see platform notes). On a static site or custom stack, point the web server at your 404 file. In Nginx, add error_page inside the server block, then run sudo nginx -t && sudo systemctl reload nginx.
htaccess`.
server {
server_name example.com;
root /var/www/example.com;
error_page 404 /404.html;
location = /404.html {
internal;
}
}Keep the real 404 status code
The helpful page must still return HTTP 404 (or 410 for content you removed on purpose). Don't redirect all missing URLs to the homepage, and don't serve the error page with a 200 status. Google treats both as soft 404s, and the bad URLs stay in its reports.
In single-page apps, render the not-found view on the server, or add <meta name="robots" content="noindex"> if a 200 can't be avoided.
Test the result
Repeat the curl commands from step 1 with a fresh random URL. Confirm the status line shows 404 and the HTML contains links to / and your search form. Also test a deep path like /blog/2019/missing-post/ and an old product URL.
On some platforms these use different templates. Then re-run the site audit.
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/blog/2019/missing-post/
curl -s https://example.com/blog/2019/missing-post/ | grep -E 'href="/"|role="search"|action="/search"'Platform-specific notes
WordPress
Block themes: go to Appearance > Editor > Templates > Page: 404, then add a Search block and a List or Navigation block with your links. Classic themes: edit 404.php in a child theme and call get_search_form(). WordPress search uses /?s=, not /search?q=.
Shopify
Go to Online Store > Themes > Customize, then pick '404 page' from the template dropdown at the top. Add rich text with links plus a search or collection list section. Shopify search lives at /search?q=, and the template already returns a 404 status.
Wix
In the Wix Editor, open Pages & Menu, then the error or system pages section, and select the 404 Error Page to edit it like any other page. Add a Search bar element and text links. Wix serves this page with the correct 404 status automatically.
Webflow
Open the Pages panel, scroll to Utility Pages and edit '404'. Add a Search element (requires site search enabled in Site settings > Search) and link blocks, then publish. Webflow returns a 404 status for this page.
Next.js
With the App Router, create app/not-found.tsx and include <Link href="/"> and a search form. Call notFound() from next/navigation in dynamic routes when data is missing, so the page renders with a 404 status instead of 200.
Check that it worked
✅ How to verify
- Run curl -I on a random non-existent URL and confirm the first line shows 404, not 200 or 301.
- View the page source (Ctrl+U / Cmd+Option+U) on a missing URL and confirm it contains <a href="/"> and a search form or links to popular pages.
- Use Search Console's URL Inspection > Test live URL on a missing URL and check that it reports a 404 rather than a soft 404.
- Re-run the site audit and confirm the check reads 'The 404 page links back into the site.'
⚠️ Common mistakes
- Redirecting every missing URL to the homepage, which creates soft 404s and confuses visitors who expected specific content.
- Building a nice error page that returns HTTP 200, so search engines index it as a real page.
- Adding the links only through JavaScript after load, so crawlers and audit tools see a page with no links.
- Pointing the search form at the wrong URL or parameter, so searches from the 404 page return no results.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Does a custom 404 page help SEO?
Not directly; 404 errors on their own don't hurt rankings. A helpful 404 page keeps visitors and crawlers moving through your site instead of leaving, and that protects engagement and internal link flow.
Should I redirect 404 pages to the homepage?
No. Google treats mass redirects to the homepage as soft 404s. Redirect a dead URL only when there is a close replacement page, and let everything else return a 404 with helpful links.
What should a good 404 page include?
Your normal header and navigation, a short plain-language message, a search box, a link to the homepage and 3-6 links to popular pages or categories. Optionally add a contact link so people can report the broken link.
Should my 404 page be noindex?
If it returns a real 404 status, search engines won't index it, so noindex isn't needed. Add it only if your setup forces the error page to return 200, such as some single-page apps.
How to Fix a Slow Largest Contentful Paint (LCP) on Mobile
How to Fix Soft 404 Pages and Return a Real 404 Status
How to Fix Interaction to Next Paint (INP) Above 200ms
How to Fix 302 Redirects Used for Permanent Moves
How to Fix Cumulative Layout Shift (CLS) on Your Website
How to Fix Redirect Loops (ERR_TOO_MANY_REDIRECTS)