Flatten Redirect Chains and Choose the Right Status Code for Every URL Move.

By · Published · Updated · About 11 min read

Built from 8 notes in Victor's vault. Drafted with Claude Opus 5.5 and Claude Fable 5.1, rewritten against Victor's notes with Claude Opus 5.5. Reviewed by Victor on 2026.11.11.

On this page (9)
  1. Choose the right redirect type
  2. Understand why chains hurt
  3. Find chains
  4. Fix chains
  5. Prevent redirect loops
  6. Manage redirects as code
  7. Handle domain-level redirects
  8. Make redirects fast
  9. Set hop limits, removal rules, and retention

A site moved to HTTPS in 2019, dropped www in 2021, and restructured its URLs in 2024. Each project added its own redirects. Today a link to an old product page passes through three hops before it loads. Some old URLs loop between the CDN and the origin.

Many developers treat redirects as a path map. That view misses four SEO effects. Chains grow to three or four hops. Temporary redirects stand in for permanent ones. Loops trap crawlers. Meta refresh redirects slow users down.

Every hop is another round trip, and another place for a crawler to stop. Any decision in a business can be an SEO decision. A CEO who rebrands without redirects proves it. During a migration, careless redirects can hold rankings down for months.

This guide covers the redirect types, how to find and fix chains and loops, and the habits that stop redirect debt from growing.

Choose the right redirect type

Choose the right redirect type
TypeMeaningSEO effectUse for
301 Moved PermanentlyThe URL moved for goodA strong signal that the target should be canonical; Google moves ranking signals to it and drops the old URL over timePermanent moves, domain migrations, URL structure changes
302 FoundThe move is temporaryA weak canonical signal; Google usually keeps the original URL indexedA/B tests, seasonal promotions, short maintenance pages
307 Temporary RedirectTemporary, and the method must not changeSame as 302Temporary moves where a POST must stay a POST
308 Permanent RedirectPermanent, and the method must not changeSame as 301Permanent moves for APIs and forms; all current browsers support it
Meta refreshAn HTML tag redirects after a delayGoogle treats an instant refresh as permanent and a delayed one as temporary; slower for usersOnly when you cannot send a server redirect
JavaScript redirectwindow.location changes the pageGoogle follows it after rendering, with delay and less reliabilityOnly when server redirects are impossible, such as client-side routing in a single-page app

Some hosts pick the code for you. Cloudflare Pages, where I host my builds, answers /page.html with a 308 to the clean URL. Check what your host sends before you write rules.

Google representatives stated in 2016 that 3xx redirects do not lose PageRank. That applies to one clean hop. Chains still cost time, crawl effort, and reliability.

Stop the 302 habit

Many developers default to 302 because it feels reversible. Search engines read it literally. The old URL stays canonical, and the new URL does not collect authority. Months after a redesign, old URLs still rank and traffic splits between them.

At Grey Matter my standing rule for broken pages was a 301 to a relevant page, not a 302 and not a 404. At Tech SEO Connect 2026, Zach Chahalis of iPullRank, in the talk "What I've Learned Doing Over 100 Website Replatformings and Migrations", put the temporary window at two to three weeks. It showed a site that had served every redirect as a 302 for eight years. After the switch to 301s, its average position rose about two places.

Use 301 for permanent changes. If a move might reverse within weeks, use a 302 and give it an end date.

Understand why chains hurt

A chain forms when URL A redirects to B, B to C, and so on. Each hop adds five kinds of cost:

Chains also change which page Google reads. I once traced a bank's homepage through HTTPS, then HTTP, then HTTPS again. The last page carried a canonical to a URL users never reached. Crawler and visitor ended on different pages, and the results showed the crawler's metadata, not the copy the bank wrote.

Know how chains form

Chains and loops were among the ten most common issues in my Grey Matter intake audits. One HubSpot site arrived with 270 chains.

Find chains

Command line. Trace one URL with curl:

curl -I https://example.com/old-page

Each 301 or 302 response is one hop. Add -L to follow the whole chain. Chahalis showed why raw requests matter: browsers and most SEO tools honor HSTS and upgrade HTTP to HTTPS silently, which hides an HTTP URL that still returns 200.

Browser tools. The Network panel in browser developer tools shows each redirect response in order. My first pass on any site uses the Redirect Path extension. A single 301 or 302 is fine. Several in a row is an issue to fix.

Screaming Frog SEO Spider. Crawl the site and open the redirect chains report. It lists hop counts and final destinations.

Google Search Console. The Page indexing report lists "Page with redirect" and "Redirect error" URLs. URL Inspection shows how Google resolved a specific URL.

Ahrefs Site Audit or Semrush Site Audit. Both report chains with hop counts and flag long chains as priority issues.

A script for scale. This Python function follows each hop without letting the library auto-follow, and resolves relative Location headers:

import requests
from urllib.parse import urljoin

def trace_redirects(url, max_hops=10):
    hops = []
    for _ in range(max_hops):
        response = requests.head(url, allow_redirects=False, timeout=10)
        hops.append((url, response.status_code))
        if response.status_code not in (301, 302, 303, 307, 308):
            break
        location = response.headers.get('Location')
        if not location:
            break
        url = urljoin(url, location)
    return hops

print(trace_redirects('https://example.com/old-url'))

Some servers answer HEAD differently from GET. If results look wrong, switch to requests.get with stream=True. Server logs show which redirects Googlebot actually hits; the log file analysis guide shows how to count them.

Fix chains

Flatten. Point every redirect straight at the final destination. Replace A to B to C with A to C.

Before:

http://example.com/page -> https://example.com/page -> https://example.com/new-page

After:

http://example.com/page -> https://example.com/new-page

Keep one redirect map. Store every source and destination in one place: a CSV file, a database table, or a configuration file. When URLs change again, update the old entries to point at the new final URLs, not at intermediate ones.

My process starts from a crawl export. I mark each URL keep, delete, or redirect, and the client approves the list before anything ships. Settle redirects before metadata. After the rules go live, crawl again.

Test in CI. Before each deployment, a script should confirm four things:

The SEO testing guide for CI/CD pipelines shows where these checks run.

Use a redirect manager. On WordPress, the Redirection plugin and the redirect manager in Yoast SEO Premium track redirects and detect chains. Enterprise platforms often include redirect management.

Start with the URLs that matter. With limited time, fix chains first on:

Prevent redirect loops

A loop forms when A redirects to B and B leads back to A, directly or through other URLs. Browsers and crawlers stop at their limit and show "Too many redirects".

Common causes:

You find loops through browser errors, crawler reports such as Screaming Frog's, or curl -L failing at its redirect limit.

To prevent them, test every redirect right after you add it, in staging first. Document each rule. Keep rules simple, because complex rules create circular logic.

To resolve a loop, find the pair of rules that redirect to each other. Remove or narrow one of them. Then test every variation: HTTP and HTTPS, www and non-www, with and without a trailing slash.

Manage redirects as code

One home for all rules. Keep redirects in one place, not spread across .htaccess files, application code, and CDN settings.

A redirect layer. Route all requests through one redirect handler. You get consistent status codes, central logs, and rule changes without an application deployment.

Version control. Keep redirect maps in Git for history, rollback, and review.

Expiry for temporary redirects. Give every 302 an end date. At that date, convert it to a 301 or remove it.

Canonical routing in the application. Enforce the canonical form of each URL in routing logic, so a non-canonical variation redirects once, before other rules run. On my builds, canonicals, sitemap, and internal links all use one URL form, so no navigation link passes through a redirect. The canonical tags guide for developers covers how redirects and canonical tags work together.

Pattern rules for large moves. Use one pattern instead of thousands of single mappings. One-off rules pile up into chains. In nginx, a named capture keeps the rest of the path:

location ~ ^/old-category/(?<rest>.*)$ {
    return 301 /new-category/$rest;
}

This sends every URL under /old-category/ to the same path under /new-category/. In Apache, RedirectMatch 301 with a numbered back-reference does the same job.

Handle domain-level redirects

Domain consolidation. Redirect at the server level. Cover every subdomain and URL variation, not only the pages you remember.

Cross-domain moves. Send each old URL directly to its final URL on the new domain with one 301. Do not route through intermediate domains or subdomains. When I scope a rebuild, every current URL gets mapped, so the new site keeps the old one's momentum.

HTTPS. Redirect HTTP to HTTPS in the server configuration. Add HSTS so browsers use HTTPS without a redirect after the first visit:

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

www or not. Choose one host and redirect the other:

server {
    server_name www.example.com;
    return 301 https://example.com$request_uri;
}

Trailing slashes. Pick /page/ or /page, and redirect the other form to it.

Make redirects fast

Redirect at the edge. Cloudflare, Fastly, and Amazon CloudFront can answer redirects from edge locations, which is faster than a round trip to the origin. The edge SEO guide covers redirects in CDN workers.

Know how browsers cache. Browsers cache 301 responses by default, often with no expiry. A wrong 301 is hard to undo in their browsers. Test before you ship. For 302 responses, set an explicit Cache-Control header if you want them cached.

Plan final URLs first. In a migration, map each old URL to its final new URL from the start. Do not ship an interim structure.

Watch latency. Track redirect response times in server logs. Slow redirects point to server load or rule logic that needs work.

Set hop limits, removal rules, and retention

Hop limit. Zero hops is ideal, and one is the working maximum. Googlebot follows up to 10, but every extra hop adds cost and risk.

Missing pages. If equivalent content exists, redirect to it with a 301. If the content is gone and has no close successor, return 404 or 410 and remove the links that point at it. Do not redirect every missing page to the homepage. Google treats those redirects as soft 404s, and users land somewhere they did not expect. The HTTP status codes guide covers each response.

Retention after a migration. Keep redirects for important pages indefinitely, because links and bookmarks last for years. Google's site move guidance says to keep redirects for at least one year. For low-value pages with no traffic or links after 12 to 24 months, you can retire them.

Keep a record of redirect chain resolution and status code selection

Next steps for redirect chain resolution and status code selection

Topic map for redirect chain resolution and status code selection

Every page in this topic

  1. Stop your code from creating duplicate URLs with canonicals, redirects, and clean routing
  2. Configure your CDN so crawlers get fresh pages and users get fast ones
  3. Trace each failing Core Web Vital to its root cause
  4. Sequence SEO engineering work so each layer builds on a working foundation
  5. Control faceted navigation so filters help shoppers without flooding Google with URLs
  6. Fix your product page template so each product ranks for its buying searches
  7. Ship SEO fixes at the CDN edge when the backend cannot change
  8. Implement hreflang so each searcher lands on the right language version
  9. Optimize website images to speed up pages and rank in image search
  10. Notify search engines of new URLs with IndexNow and the Google Indexing API
  11. Set up international SEO so each market finds its own version of your site
  12. Use popups and interstitials to capture leads without losing mobile rankings
  13. Configure React, Vue, and Angular rendering so search engines index every page
  14. Fix JavaScript SEO so crawlers read your content without a render step
  15. Flatten redirect chains and choose the right status code for every URL move
  16. Run a Screaming Frog audit without code and hand developers a ranked fix list
  17. Resolve eight SEO and accessibility conflicts so one semantic build serves users and crawlers
  18. Set up GA4, Search Console, and attribution so you can trace organic search from impression to revenue
  19. Connect GA4, Search Console, and Ahrefs data to diagnose SEO performance
  20. Keep your SEO work inside copyright, privacy, disclosure, and trademark law
  21. Assess your SEO program's maturity stage and plan the next step
  22. Write SEO OKRs that connect search work to revenue and market share
  23. Assign SEO onboarding work by role so search work ships in 90 days
  24. Turn SEO work into sprint-ready tickets that engineering ships
  25. Assess SEO skills by level to close the gap before your next promotion
  26. Fit SEO work into two-week sprints without stalling feature delivery
  27. Plan a 12-month SEO strategy in four quarters that build on each other
  28. Learn SEO writing basics so your content ranks and still reads well
  29. Use server-side rendering to get JavaScript pages indexed and ranked
  30. Run your first 90 days of startup SEO and prove that organic traffic converts

More in SEO by role

Neighboring topics

Services for this work