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
| Type | Meaning | SEO effect | Use for |
|---|---|---|---|
| 301 Moved Permanently | The URL moved for good | A strong signal that the target should be canonical; Google moves ranking signals to it and drops the old URL over time | Permanent moves, domain migrations, URL structure changes |
| 302 Found | The move is temporary | A weak canonical signal; Google usually keeps the original URL indexed | A/B tests, seasonal promotions, short maintenance pages |
| 307 Temporary Redirect | Temporary, and the method must not change | Same as 302 | Temporary moves where a POST must stay a POST |
| 308 Permanent Redirect | Permanent, and the method must not change | Same as 301 | Permanent moves for APIs and forms; all current browsers support it |
| Meta refresh | An HTML tag redirects after a delay | Google treats an instant refresh as permanent and a delayed one as temporary; slower for users | Only when you cannot send a server redirect |
| JavaScript redirect | window.location changes the page | Google follows it after rendering, with delay and less reliability | Only 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:
- Latency. Each hop is another round trip before content starts to load.
- Crawl effort. Googlebot follows each hop, which uses crawl capacity that could reach real pages. Googlebot follows up to 10 hops; past that, Search Console reports a redirect error.
- Signal loss in practice. Each extra hop is a place for a misconfiguration to hide. A link to A that reaches D through B and C is less reliable than a direct link to D.
- Failure risk. Each hop can time out, break, or go offline.
- Analytics gaps. Referrer data can drop along the way.
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
- Stacked migrations. HTTP to HTTPS adds one redirect,
wwwto non-wwwadds another, and a URL restructure adds a third. Nobody flattens them. - Repeated URL changes. Marketing changes a pattern, product refines it, and engineering changes it again. Each change adds a hop instead of an update to the old rules.
- Platform moves. A site moves from WordPress to Shopify to a custom platform, and each move keeps the previous redirects. Some URLs end up with four or five hops.
- Domain consolidation. Acquired domains redirect to old main-site URLs, which later redirect to new main-site URLs.
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:
- no redirect has more than one hop;
- each redirect uses the right status code;
- no loops exist;
- every target returns 200, not 404 or 500.
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:
- pages that still get search traffic;
- pages with backlinks from other sites;
- conversion pages, such as products, pricing, and contact.
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:
- conflicting rules in
.htaccess,nginx.conf, or application code; - an HTTP-to-HTTPS rule that fights an HTTPS misconfiguration sending traffic back to HTTP;
- the same conflict between
wwwand non-www; - CDN rules that contradict origin server rules.
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.
