UrlEdge
Back to Blog
October 22, 2025 Sarah J.5 min read

Migrating Shopify URLs to a Headless Storefront Without SEO Loss

Plan a Shopify-to-headless URL migration with a redirect map, bulk rules, staging validation, UTM preservation, and launch-day checks.

Developer reviewing a Shopify storefront on a laptop while planning a headless migration

Why Shopify URL migrations break

When you move from Shopify Liquid to a headless storefront built with Next.js, Hydrogen, or a custom stack, the visual redesign is rarely the dangerous part. The risk is the URL layer.

Shopify enforces a rigid structure:

  • /products/{handle}
  • /collections/{handle}
  • /pages/{handle}

A headless build often introduces shorter or more flexible routes:

  • /shop/{handle}
  • /c/{handle}
  • /{handle}

That can be good for the new storefront. It is bad for launch day if old Shopify URLs still appear in Google, emails, paid ads, affiliate links, QR codes, partner pages, and customer bookmarks.

The migration risk

Without a redirect map, a headless migration usually creates three problems:

  1. 404 errors: Googlebot and real shoppers hit product, collection, and content URLs that no longer exist.
  2. Lost ranking signals: backlinks, internal links, and old search results no longer point cleanly to the best new destination.
  3. Campaign breakage: email, paid social, influencer, and affiliate links stop carrying shoppers to the right product or category.

[!WARNING] Do not wait until DNS cutover to build redirects. The redirect map should be ready, imported, and crawled in staging before the new storefront receives production traffic.


Step 1: Export your legacy Shopify URLs

Before you write redirect rules, export the URLs that already receive traffic. Start with Shopify, then enrich that list with SEO and analytics data.

Method A: Shopify Admin

Go to Products > Export and choose "All products". This gives you a CSV with a Handle column.

Handle,Title,Variant Price
cool-tshirt,Cool T-Shirt,29.99
blue-jeans,Blue Jeans,49.99

Method B: Sitemap parsing

For a broader list that includes products, collections, pages, and blog posts, parse the Shopify sitemap.xml.

# Install a sitemap parser
npm install -g sitemap-to-csv
 
# Fetch and convert
sitemap-to-csv https://store.example/sitemap.xml > urls.csv

Method C: Search and analytics exports

Shopify does not know every URL that matters. Export high-value URLs from:

  • Google Search Console pages with impressions and clicks
  • Google Analytics or warehouse landing-page reports
  • paid media URLs with active UTM parameters
  • affiliate and partner links
  • customer emails and lifecycle campaigns

Those URLs should be marked as high priority in the redirect map.


Step 2: Design the redirect map

You do not always need a one-to-one rule for every URL. Pattern rules can handle predictable Shopify structures, while one-off rules cover discontinued products, merged categories, and high-value exceptions.

Scenario A: Simple Prefix Change

  • Old: https://shop.example/products/blue-jeans
  • New: https://shop.example/shop/blue-jeans

UrlEdge Rule:

  • Source: ^/products/(.*)$
  • Destination: /shop/$1
  • Type: 301 (Permanent)

Scenario B: Removing prefixes

  • Old: https://shop.example/products/blue-jeans
  • New: https://shop.example/blue-jeans

UrlEdge Rule:

  • Source: ^/products/(.*)$
  • Destination: /$1

[!TIP] Be careful with root-level product URLs. Make sure the new router does not conflict with /about, /contact, /cart, or collection slugs.

Scenario C: Preserving campaign parameters

Campaign links often survive for months in email, SMS, creator posts, and paid ads.

https://shop.example/products/blue-jeans?utm_source=newsletter&utm_campaign=spring

should land on:

https://shop.example/shop/blue-jeans?utm_source=newsletter&utm_campaign=spring

If the redirect strips query parameters by accident, your migration can look successful in crawl tools while campaign attribution quietly breaks.


Step 3: Implement redirects at the edge

You can handle redirects in the headless app, but that ties migration routing to frontend deployments. For large redirect maps, it is usually cleaner to keep redirects in a dedicated edge layer.

Developer working in a code editor while implementing redirect logic for a headless storefront migration

The latency problem

If you handle redirects in next.config.js or Middleware, the request has to hit your origin server (Vercel/Node.js), spin up a compute instance, match the rule, and respond.

MethodLatency (p95)Infrastructure
Shopify Native120msShopify Core
Next.js Middleware300ms+Serverless Cold Starts
UrlEdge25msGlobal Edge Network

Configuration

With UrlEdge, you can import your CSV map or define regex rules directly.

{
  "rules": [
    {
      "source": "^/products/(.*)",
      "destination": "/shop/$1",
      "type": 301
    },
    {
      "source": "^/pages/contact-us",
      "destination": "/contact",
      "type": 301
    }
  ]
}

Step 4: Verification

Before switching DNS, test the old URL inventory against the new redirect layer.

  1. Staging domain: Point a staging hostname to UrlEdge and test high-value URLs first.
  2. Curl test:
curl -I https://staging.shop.example/products/old-product
 
# Expected Output:
# HTTP/2 301 
# location: /shop/old-product
# x-urledge-rule: regex-product-match
  1. Crawl test: Use Screaming Frog or a similar crawler to test the old URL list against the staging environment.
  2. Campaign test: Check at least a few URLs with utm_source, utm_medium, utm_campaign, coupon parameters, and affiliate parameters.
  3. Exception review: Make sure discontinued products route to the best collection, replacement product, or support page instead of the homepage by default.

Conclusion

A headless Shopify migration needs two launches: the new storefront and the redirect layer that keeps old traffic alive. Treat the redirect map as launch infrastructure, not cleanup work.

Moving redirect logic to the edge lets your team:

  • keep large redirect maps out of frontend code;
  • validate rules before DNS cutover;
  • preserve product, collection, and campaign paths;
  • update exceptions without redeploying the storefront.

Ready to plan the redirect map? Start your free UrlEdge account and import your first batch before launch day.

Ready to optimize your redirects?

Start using UrlEdge today to manage your traffic at the edge.

Get Started

Related Articles

View all