Creating Bulk Redirect Using Liquid Variable

Topic summary

Main issue: Product links appear in two formats—short “/products/product-name” and long “/collection/collection-name/products/product-name.” Collection pages have been updated to list the short format, but many existing posts still contain mixed long and short links.

  • Update: Collection pages no longer append “/collection/collection-name/” when listing product URLs.
  • Current behavior: Navigating via a collection page still shows the longer URL structure.
  • Request: A bulk redirect solution using Liquid variables (Shopify’s theme templating language) to automatically redirect long URLs to the short version.
  • Context: Site uses the Dawn theme.
  • Goal: Ensure consistent product URLs across the site by redirecting legacy long links.
  • Media/attachments: None referenced.
  • Status: No responses or actions yet; the question remains open with no confirmed solution.
Summarized with AI on February 5. AI used: gpt-5.

I have updated our site’s collection pages to not append the /collection/collection-name/ to our product URLs. They’re listed as “sitename.com/products/product-name” but going through a collection page it looks like “sitename.com/collection/collection-name/products/product-name.” While that has been resolved, we have a lot of posts on the website that contain links to products and are split between long and short URLs.

Is there a way to create a URL redirect script using Liquid variables to automatically redirect from the long to the short version? If it matters, we are using Dawn. Thank you!