A 404 for a page that genuinely no longer exists is correct HTTP, not an SEO problem. Google’s guidance is blunt about it: 404s are normal, and no penalty lands on the rest of a site because some old URLs return them. The real costs are narrower — an inbound-linked URL that dies stops passing anything to you, a very large site burns crawl capacity on URLs that will never resolve, and a visitor who hits a dead end leaves. One case is genuinely damaging and nobody notices it: the soft 404, where a “not found” page returns HTTP 200. This guide is the triage side of the problem — finding the 404s that cost money, deciding per URL between a 301, a 410, leaving it alone, or restoring the content, and proving the decision took effect. If your pages are 404ing and they should not be, fix that first: WordPress 404 troubleshooting.
What you’ll accomplish
- A ranked list of the 404 URLs real visitors and crawlers request, separated from the bot noise that dominates every WordPress access log.
- A written decision for each URL that matters — 301, 410, leave it, or restore — that you can still defend six months from now.
- Redirects implemented at the layer that fits the volume: a plugin table for a handful, web-server rules for thousands.
- Every soft 404 converted into an honest status code, which is the only part of this work that changes how the site is indexed.
- A 404 template that recovers a share of the visits instead of ending them.
Prerequisites
- A WordPress site on a currently supported release. Nothing below is version-specific — WordPress has returned proper 404 status codes from its 404 template since long before the block editor, and that has not changed across the 5.x and 6.x lines.
- Search Console verified for the property, with at least a few weeks of history. If it is not set up yet, start with Google Search Console setup for WordPress.
- Shell access to the raw access logs, or a hosting log viewer that exposes status codes. Paths differ:
/var/log/nginx/access.logon nginx,/var/log/apache2/access.logon Debian-family Apache, and~/access-logs/inside a cPanel account. Rotated files are usually gzipped, so usezcatfor anything older than today. curlon your workstation. The browser network tab shows status codes too, but onlycurlgives you something you can loop over.- An inventory of the redirect layers already active. A CDN rule, a web-server rule, and a WordPress plugin can all answer the same URL, and only the first in the chain wins.
How it works
Three separate mechanisms get bundled under “404s hurt SEO”. Two are cheap to ignore and one is not.
Indexing. When Googlebot gets a 404 for an indexed URL it does not drop the URL immediately. It backs off, recrawls at a decreasing rate, and removes the URL once the 404 repeats over a period of weeks. Nothing in that process penalises the rest of the site. A 410 Gone behaves almost identically, with removal somewhat sooner because 410 states the removal is deliberate rather than possibly transient. Neither status is a ranking signal you can tune.
Link equity. This is the real money. If an external site links to /2019/pricing/ and that URL now 404s, the value of that link is lost — there is nothing on the other end to receive it. A 301 to a genuine equivalent recovers it. A 301 to something unrelated, or to the homepage, does not: Google resolves those to a soft 404 and treats the URL as if it had 404’d anyway, except now you also have a rule to maintain.
Crawl capacity. Every request Googlebot spends on a dead URL is one it did not spend on a live one. On a 400-page site that is a rounding error. On a site with hundreds of thousands of URLs — a large WooCommerce catalogue, a news archive, a directory — it starts to matter, and the fix is usually to stop generating the dead URLs rather than to redirect them.
That tree is the whole strategy: work top to bottom, and the first yes settles it. Google’s Search Central documentation covers how each status is handled.
Step-by-step
1. Confirm what the server actually returns. The browser is not a witness here — a themed “not found” page looks identical whether the response was 404 or 200. Check the header directly:
curl -sIL -o /dev/null -w '%{http_code} %{num_redirects} %{url_effective}\n' https://example.com/old-page/
Expected output for a URL that is correctly gone:
404 0 https://example.com/old-page/
For a URL you have already redirected, expect exactly one hop:
200 1 https://example.com/new-page/
If you get 200 0 on a page whose body says “nothing found”, you have a soft 404. Note it and continue.
2. Rank the 404s by how often they are actually requested. The access log is the only source that tells you what is being hit right now. For the standard combined log format, field 9 is the status and field 7 is the path:
awk '$9 == 404 {print $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -30
Expected output on a typical WordPress site:
1841 /wp-login.php
612 /.env
418 /old-pricing/
203 /2019/06/product-launch/
44 /wp-content/uploads/2021/brochure.pdf
The shape of that list is the point. Most of the volume is reconnaissance traffic with nothing to do with your content, and the handful of real URLs underneath it is the entire working set.
3. Separate internal 404s from external ones. Field 11 is the referrer, which says whether the dead link is on your own site or someone else’s:
awk '$9 == 404 {print $11, $7}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
Expected output:
418 "https://example.com/blog/" /old-pricing/
97 "https://partner.example.net/tools" /2019/06/product-launch/
Your own domain in the referrer means a broken internal link, and the fix is to edit the content, not to add a redirect. An external referrer means a real inbound link points at a dead URL — the strongest single argument for a 301.
4. Pull the crawler’s view from Search Console. Under Indexing, open Pages and export two rows: “Not found (404)” and “Soft 404”. The logs tell you what is requested this week; Search Console tells you what Google still has on file, including URLs nobody has requested in a year. The lists overlap less than people expect, and the report lags two to three days, so do not read it as proof of yesterday’s fix.
5. Find which dead URLs carry inbound links. In Search Console, open Links, then “Top linked pages”, and export. Intersect it with your 404 export:
comm -12 <(sort -u 404-urls.txt) <(sort -u linked-urls.txt)
Expected output is short — usually a few dozen URLs at most:
https://example.com/old-pricing/
https://example.com/2019/06/product-launch/
That intersection is your redirect shortlist. Nearly everything off it can be left alone.
6. Apply the tree per URL, and write the answer down. Restore if deleting it was a mistake and the demand is still there; that is the only option that recovers rankings intact. Use 301 if links or traffic still arrive and one live page is a true equivalent. Use 410 if the page was indexed and the content is gone with no successor. Leave everything else at 404. The rule that saves the most future work: one redirect points at one specific page, or it does not get written.
7. Implement a handful of redirects inside WordPress. Under a few hundred rules, a redirect plugin is the right tool — Redirection, or the redirect manager in Rank Math or Yoast Premium. Rules live in a database table and fire during PHP execution, so WordPress boots for every redirected request. That is fine at low volume and lets non-technical staff add rules without a deploy. Redirection also offers 410 as a rule action, the easiest way to ship the 410 decisions from step 6.
8. Implement thousands of redirects at the web server. Past a few hundred rules, move them out of PHP. On nginx, a map block in the http context compiles to a hash lookup that costs almost nothing:
map $request_uri $redirect_target {
default "";
/old-pricing/ /pricing/;
/2019/06/product-launch/ /guides/product-launch/;
}
Then inside the server block:
if ($redirect_target) {
return 301 $redirect_target;
}
Test before reloading:
nginx -t
Expected output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
On Apache, the equivalent lives above the WordPress block in .htaccess, because the WordPress block ends the rewrite chain for anything it matches:
RedirectMatch 301 ^/old-pricing/?$ /pricing/
RedirectMatch 410 ^/discontinued/
There is no configuration test for .htaccess; a syntax error surfaces as a 500 on the next request, so verify with curl right after saving.
9. Convert soft 404s into honest ones. The usual causes are a plugin rendering an “out of stock” or “no results” view at 200, a page builder serving a placeholder, or a “redirect all 404s to the homepage” setting someone enabled years ago. When the fix belongs in a template, WordPress exposes the status header directly:
status_header( 404 );
nocache_headers();
Both are core functions; status_header() is documented in the WordPress code reference. The success signal is step 1 returning 404 0 where it previously returned 200 0.
10. Make the 404 template earn the visit. A page that only apologises wastes traffic you already paid for. Ship a search box pre-filled with words from the requested path, the most-read posts, the top-level sections, and a plain link home. Do not add noindex — a correct 404 is already excluded, and the tag only matters when the status code is wrong, in which case fix the status code. Fire an analytics event carrying the requested path and referrer, so the step 2 ranking keeps updating without log access.
Validate it works
Put every URL you decided on into a file, one per line, and check them all at once:
while read -r url; do
printf '%s -> ' "$url"
curl -sIL -o /dev/null -w '%{http_code} %{num_redirects} %{url_effective}\n' "$url"
done < decided-urls.txt
Expected output, with one line per decision:
https://example.com/old-pricing/ -> 200 1 https://example.com/pricing/
https://example.com/discontinued/widget/ -> 410 0 https://example.com/discontinued/widget/
https://example.com/typo-url/ -> 404 0 https://example.com/typo-url/
Three things to read there. Every redirect should show 1, not 2 or 3; anything higher is a chain, and the fix is in find and fix WordPress redirect chains. Every 410 and 404 should show 0 hops. And no line should end at the homepage unless you deliberately decided that.
Re-run the step 2 log one-liner a week later. The redirected URLs should have fallen off the top of the ranking; if one is still counted as a 404, a caching layer is still serving the old response.
Finally, open the Soft 404 row in Search Console and use Validate Fix. Expect “Validation started” the same day and a result within a couple of weeks. This is slow by design.
Troubleshooting
The redirect works in a browser but curl still returns 404. A full-page cache or CDN is holding the old response, and your browser is being served the new one from a different edge or a bypassed cookie. Check for cache headers, purge the URL, and re-test:
curl -sI https://example.com/old-pricing/ | grep -iE 'cf-cache-status|x-cache|age:'
A HIT with a large age confirms it. Purge the specific URL rather than the whole zone.
The plugin redirect never fires. Something answered first. A web-server rule, a CDN rule, or a cached 404 page all sit in front of PHP, and the plugin only sees requests that reach WordPress. Work the layers outward-in until you find the one responding, then pick which layer owns the rule and delete it from the others.
Search Console still lists the URL as 404 weeks later. Normal. Google keeps a long tail of known URLs and recrawls low-priority ones infrequently. What matters is whether a recrawl has seen the new status: use URL Inspection, then Test Live URL, which fetches the URL now rather than reading the last crawl.
Every 404 lands on the homepage. Someone enabled a “redirect 404s to home” option in a plugin or theme. It preserves nothing and mass-produces soft 404s, because Google evaluates the destination and concludes it is not an equivalent. Turn it off, then re-run step 1 across a sample of dead URLs.
The redirect table keeps growing and nobody knows why. Each migration adds a layer, and rules pointing at URLs that were themselves later redirected form chains. Flatten periodically: point every rule at its final destination, not at the next hop.
When this is the wrong approach
On a site under a few hundred URLs with no meaningful inbound links to dead pages, most of this returns nothing. Ship a useful 404 template, fix the internal broken links from step 3, and stop. Redirect maintenance has an ongoing cost, and a URL nobody requests does not repay it.
Bot probes are not an SEO problem. /wp-login.php, /.env, and plugin readme files at the top of your 404 ranking are reconnaissance; the answer is rate limiting or a firewall rule. Redirecting them only confirms to the scanner that the host is alive.
Mid-migration, chasing 404s after launch is the expensive way. Build the URL map from the old site’s inventory before cutover and ship it with the launch, so the redirects exist before the crawler finds the gaps.
And if the URLs are supposed to resolve and do not, none of this applies — that is a diagnosis problem in the rewrite and template layers, and no redirect strategy fixes a site that has stopped routing its own permalinks.
Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.