Skip to main content
How-to

How to implement 404 error for an Ecommerce Store

By ยท Updated ยท 7 min read

Why 404 Implementation Is an Ecommerce Revenue Decision

A 404 error appears when a browser requests a URL that the server cannot find. For ecommerce stores, this happens constantly: discontinued SKUs, seasonal collections that get unpublished, URL structure changes after a platform migration, and broken inbound links from affiliates or press coverage. Each unhandled 404 is a shopper who hit a dead end.

Implementing 404 errors correctly means two things: configuring the server to return the proper HTTP status code (404 or 410), and building a branded page that routes the shopper somewhere useful. Stores that skip the second step keep the status code correct but lose the conversion opportunity. Stores that skip the first step confuse Google into indexing empty or irrelevant pages, diluting crawl budget and ranking signals.

Step 1 โ€” Audit Your Current 404 Landscape Before Touching Anything

Open Google Search Console and navigate to Pages > Not Found (404). Export the full list. Cross-reference it with your server access logs to identify which 404 URLs receive real traffic versus which are phantom crawl errors with no visitors. Prioritize URLs that still get clicks โ€” those are costing you revenue today.

Run a crawl of your live site using a tool such as Screaming Frog or Ahrefs Site Audit. Flag any internal links pointing to 404 destinations. A product card on a category page that links to a deleted SKU creates a 404 that Google discovers through normal crawling, not just external links. Internal 404s are often the largest category and the easiest to fix.

Document every 404 URL in a spreadsheet with three columns: the broken URL, its monthly traffic (from Search Console), and the best redirect destination. This spreadsheet becomes your implementation source of truth for Steps 3 and 4.

Step 2 โ€” Configure Your Server to Return the Correct Status Code

The HTTP status code must be 404 (or 410 for permanently deleted pages) โ€” not 200. A page that loads content but returns a 200 status code is called a soft 404, and Google treats it as a low-quality indexed page rather than a missing resource. Check your current behavior by using a browser extension like 'HTTP Status' or running a curl command: `curl -o /dev/null -s -w "%{http_code}" https://yourdomain.com/test-missing-page`.

On Shopify, 404 handling is built into the platform โ€” deleted product pages return a proper 404 automatically, and the `404.liquid` template controls what shoppers see. On WooCommerce (WordPress), confirm your theme's 404.php template exists and that your hosting server is not overriding status codes. On custom stacks, implement 404 handling at the framework level (e.g., Django's handler404, Next.js's not-found.js) before touching the frontend.

Step 3 โ€” Implement 301 Redirects for High-Traffic Broken URLs

Any URL from your Step 1 audit that receives meaningful traffic needs a 301 redirect to its most relevant replacement. A discontinued product should redirect to the closest in-stock alternative, the parent category, or a 'similar products' search results page โ€” never to the homepage. Homepage redirects tell Google that all broken pages are equivalent to the homepage, which is false and harms crawl efficiency.

On Shopify, add redirects under Online Store > Navigation > URL Redirects, or use a bulk redirect app for large imports. On WooCommerce, use the Redirection plugin or add rules directly to .htaccess for Apache servers. On Nginx servers, add rewrite rules in your server block. For platform migrations involving hundreds or thousands of URL changes, upload redirects in bulk using CSV import โ€” manual entry at scale introduces errors.

Use 410 (Gone) instead of 404 for product lines that are permanently discontinued with no comparable replacement. A 410 signals to Google that the URL should be deindexed immediately, which is more efficient than waiting for Google to stop crawling a 404 URL over multiple crawl cycles.

Step 4 โ€” Design a 404 Page That Converts Lost Traffic

The 404 page template should include: a clear, plain-language explanation that the page is missing (not a cryptic error code), a working search bar that queries your live product catalog, links to your top three or four category pages, and a link to your homepage. These four elements cover the primary navigation paths a lost shopper would want. Avoid humor or overly clever copy that obscures where to go next.

Add a structured internal search component that pre-populates with keywords extracted from the broken URL. If a shopper lands on `/products/blue-running-shoes-womens-size-8` and that product is gone, a search for 'blue running shoes women' displayed on the 404 page is more useful than a generic search bar. Shopify merchants can implement this using URL parameter parsing in Liquid; WooCommerce merchants can do it via a custom 404.php template with PHP string manipulation.

Track 404 page interactions in your analytics platform. Create a segment for sessions that include the 404 page, then measure the exit rate and conversion rate from that segment. A 404 page with a 90%+ exit rate needs redesign. A 404 page where 20โ€“30% of visitors navigate to another page and some convert is functioning as a recovery mechanism.

Step 5 โ€” Build a Monitoring System So 404s Don't Accumulate Silently

Set up automated alerts in Google Search Console for spikes in 404 errors โ€” GSC sends email notifications when crawl errors increase significantly. Supplement this with server-level log monitoring: parse your access logs weekly for 404 status codes and flag any URL that appears more than a threshold number of times in a week (set this threshold based on your store's traffic volume).

Establish a quarterly 404 audit as a recurring operational task. Ecommerce catalogs change continuously โ€” new seasonal products launch and expire, collections get restructured, blog posts reference products that later get discontinued. A one-time fix does not hold. Each major catalog change (seasonal turnover, platform migration, domain change) should trigger an immediate audit rather than waiting for the quarterly cycle.

Connect your 404 monitoring to your product lifecycle workflow. When a product is scheduled for deletion, the person making that change should check whether the product URL has inbound links (using Ahrefs, Semrush, or Google Search Console) and add the redirect before deletion, not after. Reactive 404 fixing is always more expensive than proactive redirect planning.

Frequently asked questions

What is the difference between a 404 and a soft 404 in ecommerce?

A 404 returns an HTTP status code of 404, telling browsers and search engines the page does not exist. A soft 404 returns a 200 status code but shows an empty, thin, or 'no results' page โ€” Google sees it as a live page and may index it. Soft 404s are common on ecommerce stores when out-of-stock product pages load a skeleton template instead of returning a proper 404 or redirect.

Should I redirect all 404 URLs to my homepage?

No. Redirecting all 404s to the homepage is a common mistake. Google interprets mass homepage redirects as soft 404s and ignores them. Redirects should point to the most relevant live destination โ€” a similar product, the parent category, or a relevant search results page. Homepage redirects also frustrate shoppers who arrived with specific purchase intent and land somewhere unrelated.

How long does it take Google to stop crawling a fixed 404 URL after adding a redirect?

After a 301 redirect is in place, Google typically stops crawling the old URL within one to four weeks, depending on the page's crawl priority and your site's overall crawl budget. High-traffic URLs get recrawled faster. A 410 status code signals permanent deletion more explicitly than a 404, prompting faster deindexing, but the timeline still depends on Googlebot's crawl schedule.

Do 404 errors directly hurt my store's search rankings?

404 errors on URLs that were never indexed or linked to have no ranking impact. 404 errors on previously ranked pages cause those pages to lose their rankings as Google removes them from its index. Inbound backlinks pointing to 404 URLs waste their link equity โ€” a 301 redirect passes the majority of that equity to the destination URL, recovering the SEO value.

How many 404 errors are acceptable for a large ecommerce store?

A large catalog with active product turnover always has some 404 errors โ€” zero is not a realistic benchmark. What matters is that 404 URLs with inbound traffic or backlinks are redirected promptly, and that internal links to 404 destinations are eliminated. Monitor the ratio of 404 errors to total crawled URLs in Google Search Console; a rising ratio signals that catalog changes are outpacing your redirect management process.

MG
Written by

Matt is the founder of RunOctopus. He built All Angles Creatures from zero to page-1 rankings in reptile feeder insects in under 60 days using exactly this method โ€” turning a hard, entrenched niche into RunOctopus's proof store for programmatic SEO and AI search citation.

Connect on LinkedIn →

See what Otto would build for your store

Free architecture preview. No card required. Five minutes.

Generate Preview →