How to Fix Backlinks Pointing to 404 Pages with 301s
When another site links to a URL on your domain that now returns 404 Not Found, that link sends visitors to an error page and passes no value to your site. This guide shows you how to list every broken URL that still has external links, choose the right replacement for each one, set up permanent 301 redirects on your platform, and confirm that the backlink count drops to zero.

Why it matters
Backlinks are still one of the strongest signals search engines use to judge a page's authority. A link to a 404 gives you no ranking benefit, and Google eventually drops the dead URL from its index along with whatever relevance it had built up. Visitors who arrive from those links see an error page and usually leave, which wastes referral traffic you already earned.
AI answer engines and crawlers that follow citations also hit the dead end, so your content is less likely to be quoted. A 301 redirect to an equivalent page passes most of that link value on and turns a dead link into a working one. Because it is a server rule, it usually takes minutes per URL.
What you need
Step-by-step fix
Export broken URLs that have external backlinks
Pull the list of your URLs that return 4xx errors and still have referring domains. Each tool keeps this list in a different place:
- Ahrefs: Site Explorer > Pages > Best by links, then set the HTTP code filter to 404 (or 4xx).
- Semrush: Backlink Analytics > Indexed Pages, then tick "Broken pages".
- Moz: Link Explorer > Top Pages, then filter by status 4xx.
- Google Search Console: Indexing > Pages > "Not found (404)". Open a URL and use the URL Inspection tool to see the referring page.
Export the results to CSV with these columns: URL, HTTP status, referring domains, and backlinks.
Confirm each URL really returns 404 today
Backlink tools re-crawl on their own schedule, so some URLs in the list may already be fixed or may only have failed briefly. Re-check the live status code of every URL before you write any rules. Remove anything that already returns 200 or 301.
Keep the 404 and 410 responses, and also keep soft 404s, which are pages that return 200 but show an error template.
while read url; do
printf "%s " "$url"
curl -s -o /dev/null -w "%{http_code}\n" "$url"
done < broken-urls.txtMap every dead URL to its closest live page
Add a "Redirect to" column to your spreadsheet. Choose the destination in this order:
- The same content at its new URL.
- A newer version of the same topic.
- The closest category or parent page.
Only redirect to the homepage if nothing relevant exists. Google often treats a mass redirect to the homepage as a soft 404, and that throws away the link value. Use the final destination URL directly, so there are no chains such as A > B > C.
old_url,new_url,referring_domains /blog/2021-pricing-guide,/pricing,14 /products/widget-pro-v1,/products/widget-pro,9 /resources/seo-checklist.pdf,/guides/seo-checklist,6
Add 301 redirects on your server or CDN
Create a permanent redirect for each row of your map. Use 301 or 308, not 302 or 307. Put the rules wherever your site handles requests first.
That is usually the CDN or web server, and the CMS only if neither is available. The examples below show Nginx and Apache. Platform-specific menus are listed in the platform notes.
# Nginx (inside the server block)
location = /blog/2021-pricing-guide { return 301 https://example.com/pricing; }
location = /products/widget-pro-v1 { return 301 https://example.com/products/widget-pro; }
# Apache (.htaccess)
Redirect 301 /blog/2021-pricing-guide https://example.com/pricing
Redirect 301 /products/widget-pro-v1 https://example.com/products/widget-proHandle whole folders with one pattern rule
If an entire section moved, use a single regex redirect instead of dozens of one-off rules. For example, /blog/ might have moved to /articles/. Test the pattern against several real URLs from your export before you deploy it.
A pattern that is too broad can catch live pages too.
# Nginx
location ~ ^/blog/(.*)$ { return 301 https://example.com/articles/$1; }
# Apache
RedirectMatch 301 ^/blog/(.*)$ https://example.com/articles/$1Update internal links and the sitemap
Internal links to the old URLs still cost crawl budget and add a redirect hop. Search your CMS or codebase for the old paths and replace them with the new ones. Remove any old URLs from sitemap.xml so it lists only pages that return 200.
grep -rn "/blog/2021-pricing-guide" ./src ./content
Ask high-value sites to update their links
For your top 5 to 10 referring domains, email the site owner with the exact page, the old link and the new URL. A direct link is cleaner than a redirect, and it keeps working even if your redirect rules are lost in a future migration.
Verify redirects and re-run the audit
Run curl against every old URL in your map. Each one should return a single 301 or 308 with a Location header that points straight to a page returning 200. Then ask your backlink tool to recrawl, or wait for its next crawl, and re-run the audit.
The goal is 0 backlinks pointing to broken URLs. Above 20 is treated as a failure.
curl -sIL https://example.com/blog/2021-pricing-guide | grep -Ei "^HTTP|^location" # Expected: # HTTP/2 301 # location: https://example.com/pricing # HTTP/2 200
Platform-specific notes
WordPress
Install the free Redirection plugin and go to Tools > Redirection > Add new. Set the Source URL and the Target URL, and use the default 301 code. Redirection also supports bulk import from CSV. Rank Math (Rank Math SEO > Redirections) and Yoast SEO Premium (Yoast SEO > Redirects) work the same way. Rule order matters: server-level rules in .htaccess or Nginx run before any plugin rule.
Shopify
Go to Content > Menus > View URL redirects (in older admins: Online Store > Navigation > URL Redirects). Click Create URL redirect, or use Import to upload a CSV with "Redirect from" and "Redirect to" columns. Shopify only applies the redirect when the old path actually returns 404, so delete or unpublish the old product first. Shopify redirects are always 301s.
Wix
Open Dashboard > Marketing & SEO > SEO > Tools and settings > URL Redirect Manager. Choose New Redirect to add a single URL, or Import CSV to add many. Wix supports folder-level redirects, but not complex regex patterns.
Webflow
Go to Site settings > Publishing > 301 redirects. Add an old path and a redirect-to path, then republish the site. Webflow supports capture groups such as /blog/(.*) to /articles/%1 for moving whole folders.
Next.js / Cloudflare
In Next.js, add an async redirects() function to next.config.js that returns { source, destination, permanent: true }. Next.js sends a 308, which Google treats the same as a 301. On Cloudflare, use Rules > Redirect Rules for patterns, or Bulk Redirects (account level) for hundreds of one-to-one rules. Both run at the edge, before your origin server is contacted.
Check that it worked
✅ How to verify
- Run curl -sIL on each old URL and confirm exactly one 301 or 308 hop that ends in HTTP 200.
- In Google Search Console, use URL Inspection on a fixed URL and click Test live URL. It should report "Page with redirect". Then check that the destination page is indexed.
- Recrawl in Ahrefs or Semrush and confirm that the broken-pages list with referring domains is empty.
- Re-run this audit and confirm the count of backlinks pointing to broken URLs is 0.
⚠️ Common mistakes
- Redirecting every dead URL to the homepage. Google treats irrelevant redirects as soft 404s, so you get almost no link value back.
- Using 302 or JavaScript redirects instead of a server-side 301 or 308. These do not reliably pass link equity.
- Creating redirect chains or loops, for example pointing to a URL that itself redirects again, instead of pointing straight to the final 200 page.
- Removing redirects during a later redesign or platform migration, which brings all the 404s back.
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
Do 301 redirects pass full link equity?
Google has said that 301 and 308 redirects do not lose PageRank. In practice, most of the value transfers when the destination is topically relevant. When the destination is unrelated, Google may ignore the redirect.
Should I use a 404 or a 410 for pages I deleted on purpose?
If a deleted URL has no backlinks and no replacement, a 410 Gone tells crawlers it is permanent and gets it dropped faster. If the URL still has external backlinks, a 301 to a relevant page is almost always better. A 410 throws the link value away.
How long should I keep 301 redirects in place?
Google recommends keeping them for at least a year. For URLs with external backlinks, keep them indefinitely. Redirect rules cost almost nothing, and the links pointing at those URLs will exist for years.
How long until my backlink tool shows the fix?
Ahrefs and Semrush recrawl popular URLs within days, but rarely linked ones can take several weeks. Triggering a manual recrawl or site audit in the tool usually updates the status code sooner.
How to Fix Link Velocity: Build Backlinks at a Steady Pace
How to Fix Lost Backlinks and Reclaim Link Equity
How to Fix Unlinked Brand Mentions and Reclaim Links
How to Fix a Skewed Follow / Nofollow Backlink Ratio
How to Fix a Competitor Backlink Gap: Find and Win Links
How to Fix an Unnatural Anchor Text Distribution