A redirect chain is an old URL that redirects to another URL that redirects again, so shoppers and search engines take two or more hops to reach the page they wanted. On Shopify, chains usually build up after a migration, when a product that old URLs point to is later retired and redirected to a collection. To fix them, export your URL redirects, point each chained row straight at its final destination and import the file back.
In 2026, a client store with about 40,000 redirects had 4,255 chains. Here's how chains form, a short script that finds and flattens them, how to check the result and the two checks that stop new ones.
What a redirect chain is, and why it matters
Say your old platform sold a mug at /old-shop/mug.html. During the migration, you redirected that URL to /products/mug. A year later the mug is discontinued, so you redirect /products/mug to /collections/mugs. An old link now takes two hops:
-
/old-shop/mug.htmlredirects to/products/mug. -
/products/mugredirects to/collections/mugs.
The page still loads, which is why chains go unnoticed. But each hop is one more request before the page can start loading.
Google's guide to site moves says chaining redirects "adds latency for users" and advises pointing each redirect straight at the final destination. Where that isn't possible, it suggests chains of "ideally no more than 3 and fewer than 5" redirects.
Google's crawlers follow up to 10 redirect hops, so Googlebot still reaches the page at the end of a two-hop chain. Even so, Google's guide to crawling large sites says long redirect chains "have a negative effect on crawling."
How chains build up on Shopify after a migration
A migration usually ends with a large import of redirects from the old platform's URLs to the new Shopify ones. Shopify's own sample import file shows the pattern: /example_product.php redirects to /products/example-product.
The chains come later. Shopify only redirects broken URLs, so to retire a product, you delete it or set it to Draft, which makes its page return a 404 error. Then you redirect its URL to a collection. In our experience, Shopify doesn't touch the older redirects that point at that product, so each of them becomes a two-hop chain.
Over the years, the hops stack up. Fold that collection into another one later, and the oldest URLs take three hops. On one client store, a single batch of 46 product removals would have created 133 new chains.
Loops happen too: two redirects that point at each other, or one that points at itself. A loop never reaches a page at all.
How to find redirect chains on your store
Step 1: Export your redirects
In your Shopify admin, go to Content, then Menus, and click URL redirects. Older guides put this under Online Store and Navigation. Click Export, choose all redirects, pick a CSV type and click Export URL redirects.
The file has two columns, Redirect from and Redirect to, the same headers as Shopify's sample import file.
Step 2: Run the script to find chains
This Python script follows every redirect in the export to the end of its chain and writes a new file with only the rows that need to change. It needs Python 3.9 or later and nothing else. Save it as flatten_redirects.py in the same folder as your export:
#!/usr/bin/env python3
"""Flatten Shopify redirect chains.
Usage:
python3 flatten_redirects.py redirects.csv [new.csv] \
--host example.com > flattened.csv
Reads Shopify URL redirect CSVs (Redirect from, Redirect to).
When a Redirect from repeats, the later row wins. Writes only
the rows whose final destination differs from their target.
Loops are reported on screen and left out of the file.
"""
import csv
import sys
from urllib.parse import urlsplit
MAX_HOPS = 20
def local_path(url, hosts):
"""Turn a full URL on your own domain into a path."""
parts = urlsplit(url)
if parts.netloc.lower() not in hosts:
return url
path = parts.path or "/"
if parts.query:
path += "?" + parts.query
return path
def main(args):
hosts = set()
if "--host" in args:
i = args.index("--host")
host = args[i + 1].lower().removeprefix("www.")
hosts = {host, "www." + host}
del args[i:i + 2]
targets = {}
for name in args:
with open(name, newline="", encoding="utf-8-sig") as f:
for row in csv.DictReader(f):
src = row["Redirect from"].strip()
targets[src] = row["Redirect to"].strip()
out = csv.writer(sys.stdout, lineterminator="\n")
out.writerow(["Redirect from", "Redirect to"])
fixed = broken = 0
for src, listed in targets.items():
seen = {src}
dst = local_path(listed, hosts)
while dst in targets and dst not in seen:
if len(seen) > MAX_HOPS:
break
seen.add(dst)
dst = local_path(targets[dst], hosts)
if dst in targets:
print("Loop or too long:", src, file=sys.stderr)
broken += 1
elif dst != listed:
out.writerow([src, dst])
fixed += 1
print(f"{fixed} to update, {broken} to fix by hand",
file=sys.stderr)
if __name__ == "__main__":
main(sys.argv[1:])
Then run it in a terminal with your export's file name and your store's domain:
python3 flatten_redirects.py redirects.csv \
--host yourstore.com > flattened.csv
What it does with each row:
-
Chains get their final destination, so
/old-shop/mug.htmlpoints straight at/collections/mugs. - Full URLs on your own domain become paths, which Shopify's help recommends for redirects within your primary domain. The script needs paths to spot chains.
- Loops and chains over 20 hops are listed on screen and left out of the file. Fix those by hand.
- Everything else, including redirects to other domains and subdomains, stays as it is.
We tested it on a sample export with a two-hop chain, a three-hop chain, two loops and a full URL on the store's own domain, and it handled each one as described.
A small store may have nothing to fix. When we ran the script on our own site's 33 redirects in November 2026, it found no chains.
How to flatten the chains
Step 3: Import the flattened file
Keep your original export as a backup. Then go back to URL redirects, click Import, add flattened.csv, click Upload file, review the import and click Import redirects.
On the client stores where we've done this, a row whose Redirect from matched an existing redirect updated it in place rather than adding a duplicate. Shopify's help doesn't say how an import handles a match, so import two or three rows first and check them before you import the rest.
Step 4: Spot-check the redirects on your primary domain
Test a few old URLs from the file with curl in a terminal:
curl -sIL --max-redirs 10 -o /dev/null \
-w "%{num_redirects} hops -> %{url_effective} [%{http_code}]\n" \
"https://yourstore.com/old-shop/mug.html"
Before the import, a chained URL shows 2 hops or more. After it, the URL should show 1 hops, the right final page and [200].
A result of 0 hops with [200] means the redirect didn't fire, usually because the old URL still loads a page.
A [429] means the store turned the request away for coming too often, which happens to curl on some Shopify stores, including ours. It can show 0 hops even when the redirect works, so try that URL again later.
Test on your primary domain over https. The Domains page in your Shopify admin shows which domain is primary. On our own site, an http request adds a hop for the switch to https. On one client store, the other version of the domain (with or without www) added a hop too. Neither has anything to do with your redirect table, but both make clean redirects look like chains.
How to stop new chains
Every time you add redirects, for example when you retire a batch of products, run two checks first:
-
Outgoing: does any new redirect point at a URL that already redirects? If
/collections/winterredirects to/collections/sale, point the new redirects at/collections/sale. - Incoming: do any existing redirects point at a URL you're about to redirect? Each one becomes a chain the moment the new redirects go live, so point them at the new final destination too.
The incoming check is the one people miss, and it's where those 133 chains on our client's store would have come from.
The script runs both checks if you give it a fresh export and then your new batch, in the same two-column format:
python3 flatten_redirects.py redirects.csv new.csv \
--host yourstore.com > chain-fix.csv
Import your new batch first, then chain-fix.csv, so the corrected rows are the ones that stick.
Merging duplicate product listings is one of these batches. Our guide to merging duplicate color listings on Shopify without losing search traffic walks through the redirects it needs.
Questions we hear
Do redirect chains hurt SEO?
A short chain won't stop Google from reaching the page. But Google advises redirecting straight to the final page and says long chains hurt crawling. Every hop also makes shoppers wait. Flattening is a small job that settles the question.
Why isn't my Shopify redirect working?
Usually because the old URL still loads a page. Shopify only redirects broken URLs, so a redirect from an active product or a visible collection does nothing. Some fixed paths, such as /collections/all, can't be redirected at all.
Browsers also cache 301 redirects, so clear your cache or try another device before deciding a change didn't work.
Can I fix chains without a script?
Yes, if there are only a few. Open each chained redirect under URL redirects, change its Redirect to field and save. The script earns its keep when a store has thousands of redirects.
How many redirects can a Shopify store have?
Up to 100,000, or 20,000,000 on the Plus plan. The flattened file only changes where existing rows point.
Braun Design Co is a boutique Shopify Plus partner in Austin. Custom themes, migrations, and ongoing SEO and maintenance work for brands that already sell.
If your store has been through a migration and you're not sure what your redirect table looks like, we can audit it, flatten the chains and set up the checks for your next product cleanup. Book a 30-minute call.