Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

Migrated your site? Your redirects are probably a maze — and every extra hop burns link equity

Site migrations are where redirect debt goes to hide. You move the CMS, import the redirect map, ship it, and move on — but nobody audits what the redirect layer actually does six months later. Meanwhile Googlebot is hap

Site migrations are where redirect debt goes to hide. You move the CMS, import the redirect map, ship it, and move on — but nobody audits what the redirect layer actually does six months later. Meanwhile Googlebot is happily following old.com/page → staging.com/page → www.new.com/page → new.com/page four hops deep, leaking a slice of link equity at every step and adding seconds of latency for real users.

I built a tool that audits your URL list hop-by-hop and flags the patterns that actually cost you.

What redirect_audit.py catches

Feed it a URL list (urls.txt, one per line) and it walks each redirect chain:

  • chain_N_hops — more redirects than your threshold (default 2). Each hop leaks equity and adds latency; the fix is always "redirect directly to the final destination."
  • redirect_loop — same URL seen twice in a chain. Broken rewrite rules; users and crawlers both spin.
  • final_404 / final_5xx — the redirect lands nowhere. The worst kind: the old URL "works" (returns a redirect) but the destination is dead.
  • unreachable — connect/DNS/TLS failure before any redirect.
  • cross_domain_redirect — a hop leaves your domain. Sometimes legitimate (rebrand), sometimes a stale canonical or worse.
python3 tools/redirect_audit.py urls.txt --max-hops 2
python3 tools/redirect_audit.py urls.txt --json   # CI pipeline

Exit 0 = clean, 1 = findings, 2 = usage error. Stdlib only.

Verified against a live fixture

The kit ships examples/redirect_server.py — a localhost fixture that reproduces every failure mode: clean 200, a 2-hop chain, a redirect loop, a redirect-to-404, and a dead connection. Audit output verified: chain flagged at --max-hops 1, loop detected, final_404 caught, unreachable reported.

Honest limits

GET requests only — POST and JS-rendered redirects aren't followed (most server redirects are GET-visible anyway). No sitemap crawling; you feed it your own URL list. Sequential requests with a per-request timeout — hundreds of URLs want parallelism. And the checklist matters as much as the tool: re-audit after every CMS/plugin update, because redirect rules rot silently.

$12:

https://wesleygitari2-cloud.github.io/nexus-store-redirect/p/redirect-audit-kit

When did you last audit your redirects — and do you even have a list of old URLs worth checking?

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.