How to Fix Old URLs That Redirect to the Homepage
When a site is redesigned or migrated, old pages are often sent to the homepage with a single catch-all rule or a "redirect all 404s" plugin. Search engines treat these as soft 404s, so the old page's links and rankings are lost. In this guide you will list the URLs your site used to have, find the ones that land on the homepage, and give each one a page-to-page 301 or an honest 410.

Why it matters
Google treats a redirect from a specific page to an unrelated homepage as a soft 404. The old URL is dropped from the index and the backlinks pointing to it pass little or no value. Visitors who click an old link, bookmark or AI-cited source expect a specific product or article.
Landing on the homepage sends many of them straight back. A redirect to the closest matching page keeps the traffic, the link equity and the citation intact.
What you need
Step-by-step fix
Export the URLs your site used to have
The Internet Archive keeps a record of pages that existed on your domain. Pull that list with the Wayback CDX API, keeping only HTML pages that once returned 200. You can add older URLs from these sources too:
- Search Console: Performance and Pages exports
- Old sitemaps
- Analytics landing-page reports
- Your backlink tool's Top pages report
curl -s "https://web.archive.org/cdx/search/cdx?url=example.com/*&fl=original&collapse=urlkey&filter=statuscode:200&filter=mimetype:text/html&limit=10000" | sort -u > old-urls.txt wc -l old-urls.txt
Find the old URLs that end up on the homepage
Request every old URL, follow its redirects, and record where it ends up. Any URL whose final address is the bare root (/, with or without www) is a blanket homepage redirect and needs fixing. Save the output, because it becomes your redirect worksheet.
while read u; do
curl -s -o /dev/null -L --max-redirs 10 -w "$u\t%{http_code}\t%{url_effective}\n" "$u"
done < old-urls.txt > results.tsv
# Show only the ones landing on the homepage
grep -P '\thttps?://(www\.)?example\.com/?(\?.*)?$' results.tsv > to-homepage.tsv
wc -l to-homepage.tsvRemove the catch-all rule that causes it
Mass homepage redirects nearly always come from one rule rather than hundreds of individual entries. Look for the following and delete it:
- An Nginx
error_page 404 =301 /;line - An Apache
ErrorDocument 404 https://example.com/line (an absolute URL forces a redirect) - A wildcard
RewriteRule ^(.*)$ / [R=301,L] - A plugin like "All 404 Redirect to Homepage"
Replace it with a real 404 page that returns a 404 status code.
# Nginx: remove
# error_page 404 =301 /;
# and use instead:
error_page 404 /404.html;
location = /404.html { internal; }
# Apache (.htaccess): remove
# ErrorDocument 404 https://example.com/
# and use a relative path instead:
ErrorDocument 404 /404.htmlMap each old URL to its closest current page
Open to-homepage.tsv in a spreadsheet and add a Target column. For each old URL, choose the live page that best matches it, in this order of preference:
- The same content at its new address
- The replacement product or updated article
- The parent category or hub page on the same topic
If nothing related exists, mark the URL 410 instead of forcing a match. Only map a URL to the homepage if the old page really was a homepage variant, such as /index.html or /home.
old_path,target /blog/2021/widget-buying-guide,/guides/how-to-choose-a-widget /products/widget-v1,/products/widget-v2 /category/blue-widgets,/collections/widgets?color=blue /promo/black-friday-2019,410 /index.html,/
Deploy the 301s and 410s
Add the mappings as permanent redirects, either at the server or CDN level or in your platform's redirect manager (see Platform notes). Point each redirect straight at the final URL so there are no chains. Return 410 Gone for URLs with no equivalent.
On Nginx, a map block keeps hundreds of rules fast and readable.
# In the http {} block
map $uri $new_uri {
default "";
/blog/2021/widget-buying-guide /guides/how-to-choose-a-widget;
/products/widget-v1 /products/widget-v2;
}
server {
server_name example.com;
if ($new_uri) { return 301 $new_uri; }
location = /promo/black-friday-2019 { return 410; }
}
# Apache equivalent (.htaccess)
# Redirect 301 /products/widget-v1 /products/widget-v2
# Redirect gone /promo/black-friday-2019Update internal links and the sitemap
Redirects are the safety net for outside links, not for your own. Search your templates, menus and content for the old paths and replace them with the new targets. Make sure your XML sitemap lists only final URLs that return 200, never redirecting or 410 URLs.
Re-test the old URLs and confirm the result
txt. tsv filter should now return only true homepage variants. Every other old URL should return 200 on a relevant page after a single 301 hop, or return 410.
Spot-check a few by hand with curl -I to confirm the status code and the Location header.
curl -sI https://example.com/products/widget-v1 | grep -iE '^(HTTP|location)' # Expected: # HTTP/2 301 # location: https://example.com/products/widget-v2
Platform-specific notes
WordPress
Check **Plugins > Installed Plugins** for anything that redirects 404s to the homepage, and deactivate it. Some all-in-one SEO plugins have the same option buried in their 404 or redirect settings, so check those too. Add page-to-page rules with **Tools > Redirection** (Redirection plugin, which supports CSV import), **Rank Math > Redirections**, or **Yoast SEO Premium > Redirects**. WordPress already sends a real 404 status through your theme's 404.php.
Shopify
Shopify serves a proper 404 by default, so homepage redirects usually come from a redirect app or from bulk-imported redirects pointing to `/`. Manage redirects under **Online Store > Navigation > URL Redirects**, or search "URL redirects" in the admin. Use **Import** with a CSV that has **Redirect from** and **Redirect to** columns. Shopify cannot return 410, so send unmatched URLs to the closest collection instead, or let them 404.
Wix
Go to **Marketing & SEO > SEO > Tools and settings > URL Redirect Manager**. Edit any rule whose destination is the homepage, or replace it by importing a CSV of old and new URLs. Remove wildcard patterns that send everything to `/`.
Next.js
Define redirects in `next.config.js` under `async redirects()`, using objects like `{ source: '/products/widget-v1', destination: '/products/widget-v2', permanent: true }`. These return a 308, which search engines treat like a 301. Remove any `source: '/:path*'` catch-all that points to `/`, and any middleware doing the same. For 410s, return a `new Response(null, { status: 410 })` from middleware or a route handler.
Cloudflare
Upload page-to-page pairs as a list under **Rules > Redirect Rules > Bulk Redirects** with status 301. Then check **Rules > Redirect Rules** for a wildcard rule like `https://example.com/*` → `https://example.com/` and delete it. Rules at the edge run before your origin server, so they override server-side fixes.
Check that it worked
✅ How to verify
- Re-run the curl loop from Step 2 on all archived URLs and confirm `to-homepage.tsv` contains only real homepage variants such as /index.html.
- Use Google Search Console **URL Inspection** on several old URLs: each should report the redirect to the new page, and the target should be indexable.
- Over the next 2-6 weeks, watch **Indexing > Pages** in Search Console: the "Soft 404" count should fall and old URLs should appear under "Page with redirect".
- Re-run the site audit: the "Old URLs redirect to the homepage" check should pass with no listed URLs.
⚠️ Common mistakes
- Replacing the homepage catch-all with a catch-all to a category or search page. This is still a soft 404 if the content doesn't match.
- Using 302 or JavaScript/meta-refresh redirects for permanent moves instead of 301 or 308.
- Creating chains (old → older-new → new) instead of pointing every old URL directly at the final destination.
- Forcing a weak match for discontinued content when a 410 or a helpful 404 page would be more honest to users and search engines.
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
Is it bad to redirect all 404 pages to the homepage?
Yes. Google treats redirects from specific pages to an unrelated homepage as soft 404s, so the old URL loses its rankings and link value anyway. It also hides real broken links from your reports. Redirect to a matching page, or return a genuine 404 or 410.
Should I use a 404 or a 410 for pages that no longer exist?
Both are fine for search engines, and both get the URL dropped from the index. A 410 signals that the removal is intentional and is often processed slightly faster. Use 410 for content you deliberately removed and have no replacement for.
How long should I keep 301 redirects in place?
Google recommends at least a year, but keeping them indefinitely is safest. External backlinks, bookmarks and AI citations to old URLs keep sending visitors for many years. Redirect rules cost almost nothing to maintain.
How do I find old URLs if I no longer have the previous site?
Query the Wayback Machine CDX API for your domain to list every archived page. Combine that with Search Console's Pages and Performance exports and the top-linked pages from a backlink tool. Together these cover nearly every URL that still gets traffic or links.
How to Install Analytics on Every Page of Your Site
How to Fix Old URLs That Return 404 After a Redesign
How to Fix Duplicate Analytics Tags (Google Tag Loaded Twice)
How to Fix an Indexed Staging Site in Google and Bing
How to Fix Legacy Universal Analytics (UA-) Tracking Code
How to Enable IndexNow So New Pages Are Submitted on Publish