Shopify URL redirects: Create, import, and test 301 redirects

Create 301 redirects in Shopify or import them via CSV to resolve 404 errors after URL changes or migrations. Test the status code, target URL, and avoid redirect chains using your browser and curl.

Updated on
Shopify URL-Weiterleitungen: 301-Redirects anlegen, importieren und testen

Shopify URL redirects: Create, import, and test 301 redirects

Direct solution coming soon

  • Create redirects in Shopify under Content → Menus → URL Redirects (in some cases: Online Store → Navigation → URL Redirects ).
  • Use Import (CSV) if you have many redirects from a migration.
  • Set Redirect from as a relative path (e.g. /alte-seite ), not as a full URL.
  • Test randomly with your browser and curl -I for 301 errors and avoid redirect chains.

When does this occur?

  • After changing product, page or blog handles (e.g., /products/alt became /products/neu ).
  • After migrating from another shop system where the URL structure changed.
  • After switching collections/pages, if old URLs are still in Google, Ads, newsletters or backlinks.
  • If 404 error clusters appear in Browser/Analytics for former top URLs.

Technical background: Why does this happen?

Shopify generates URLs from handles and defined paths (e.g. /products/ , /collections/ , /pages/ ). As soon as a handle or structure changes, old paths are no longer resolvable and return a 404 error. A Shopify URL redirect is a server-side redirect that Shopify delivers as a permanent redirect (301) so that browsers and search engines permanently switch the old URL to the new target URL.

Some redirects occur automatically (e.g., when a product handle is changed, if the option to create a redirect is enabled). During migrations or structural changes, automatic redirects are typically incomplete; therefore, they must be selectively supplemented and checked for chains/loops.

Step-by-step: Here's how to implement it

  1. Create a list of old URLs

    • Export from Migration/Altshop or derive from Analytics/Google Search Console.
    • For each old URL, define the new target URL (preferably 1:1, otherwise to the most thematically appropriate page).
  2. Open redirects in the Shopify admin

    • Newer admin navigation: Content → Menus → URL redirects
    • Older admin navigation (depending on shop/plan/UI): Online shop → Navigation → URL redirects
  3. Create individual redirects

    • Click Create URL Redirect .
    • Set the redirect from as a relative path, starting with / , e.g. /alte-kategorie or /products/altes-produkt .
    • Set the redirect to path as a relative path ( /collections/neu ) or as a full URL if external.
    • Save.
  4. Bulk import via CSV (for many redirects)

    • Click Import .
    • Create a CSV file containing the Shopify column names (without any additional columns).
     Redirect from,Redirect to
     /alt,/neu
     /collections/sale,/collections/outlet
     /products/sku-123,/products/neuer-handle
     /pages/versandkosten,/policies/shipping-policy
    
    • Upload the CSV file and start the import.
    • After importing, check randomly selected entries in the list.
  5. Tests: Check status code, target, and chains

    • Browser test: Visit the old URL and make sure you land directly on the target page.
    • CLI test (returns header including status code and location):
     curl -I https://deinshop.de/alte-seite
    
    • Expectation: HTTP/2 301 (or HTTP/1.1 301 ) and a Location: header with the target URL.
    • Avoid redirect chains: the old URL should lead to the final URL in one go if possible.
  6. Optional: Check automatically generated redirects

    • If you change handles in Shopify (product/collection/page), check if Shopify has created a redirect (list of URL redirects).
    • If you deliberately do not want a redirect (rare), remove the corresponding redirect entry after making the change.

Common mistakes

  • Error: A full URL is entered in the redirect from field (e.g., https://deinshop.de/alt ). Cause: Shopify expects a path here. Fix: Use only the relative path, e.g. /alt .

  • Error: Missing leading slash (e.g., alt ). Cause: The path is not matched correctly. Fix: Always start with / , e.g. /alt .

  • Error: Redirect loop (A → B and B → A) or target redirects back to source. Cause: Duplicate/conflicting entries, often after multiple imports. Fix: Clean up affected redirects, define a unique target URL, then test again (browser + curl -I ).

  • Error: Redirect chain (A → B → C). Cause: Historically grown redirects or multiple handle changes. Fix: Redirect A directly to C (adjust the entry for A), reduce intermediate steps.

  • Error: Incorrect target page (e.g., product on collection or vice versa). Cause: Mapping error in the migration list/CSV. Fix: Correct the mapping and update the redirect entry; then randomly check the most important top URLs.

  • Error: Query parameters are "lost" and are required for tracking. Cause: Shopify redirects primarily match paths; parameters are often not managed as a rule set in practice. Fix: If parameters are mandatory, design the landing page so that it works without parameters (recommended). Alternatively, switch to the new URL in campaigns.

Best Practices

  • Prepare the redirect CSV before a migration goes live and import it directly after the domain switchover.
  • Prioritize top URLs: first the most important landing pages/products/collections (from Analytics, Logs, Ads goals).
  • No redirects to irrelevant pages (e.g., everything to the homepage). If no direct target exists, redirect to the next most appropriate category/collection.
  • One step towards the goal: regularly resolving redirect chains, especially after rebranding and multiple structural changes.
  • Keep naming conventions stable: Only change handles if there is a clear reason; always check whether the redirect was created automatically when making changes.

Brief summary

  • Shopify URL redirects fix 404 errors after handle, structure, or migration changes.
  • Redirecting from is a relative path with a leading / , not a full URL.
  • Many redirects can be imported via CSV (columns: Redirect from , Redirect to ).
  • Test for 301 errors and check Location ; avoid redirect loops and chains.
  • Keep redirects well-maintained: Prioritize top URLs and regularly clean up mappings.
Updated on