Why isn't my URL redirect working properly on my product page?

Topic summary

Main issue: Changing product URLs from /collections/…/products/… to /products/… and making redirects work when navigating via collection pages.

Key context: Shopify’s built-in URL redirects only trigger for broken/changed URLs, not for valid collection-to-product paths. Therefore, a theme-based redirect is needed.

Actions taken:

  • A code-based redirect was added to theme.liquid to force the /products/handle URL.
  • Initial code worked functionally but caused continuous page refresh (loop) on the product page.
  • Alternative snippets were tried; final guidance was to place the redirect code just before in theme.liquid.

Outcome: After adjusting placement, the redirect worked without the refresh loop. The original issue is resolved; no native setting change was required.

Unresolved/ongoing: Another participant asked how to redirect to an external WordPress thank-you page; no solution was provided in this thread.

Notes: The specific code snippets are central to the solution, but the exact code content isn’t included here. The working fix depends on correct snippet implementation and placement in theme.liquid.

Summarized with AI on January 5. AI used: gpt-5.

The path is homepage - collection - product, the automate URL is https://dexshellstore.com/collections/waterproof-hats/products/beanie-fair-isle I wanna change it to https://dexshellstore.com/products/beanie-fair-isle and I used the URL redirection but it does not work. If I search for the this particular product it will works, but if I follow homepage - collection - product it does not work, could anyone give a hint to solve this problem please? Thanks in advance.

1 Like

Hi @BellaZheng if you tried shopify url redirection, it only works if you want to redirect broken url. So you should try with this piece of code (add to theme.liquid):


If you find my answers helpful, please mark resolved or like.

Hi I added the code and it does work!
However, this page is always refreshing, do you know how to solve this?
Please check out https://dexshellstore.com/products/beanie-fair-isle

Thanks in advance.

Hi Petrovic,

I have received two codes.

The one sent to my email works, but the page is always refreshing

The one reply in community did not work, please check out https://dexshellstore.com/collections/waterproof-hats/products/beanie-fair-isle

Hi @BellaZheng , let’s try this


If you find my answers helpful, please mark resolved or like.

Hi MarinaPetrovic,

Thanks for reply. The code still did not work. :disappointed_face:


Add this in your theme liquid, just before .

@BellaZheng

2 Likes

Thanks a lot!! @MarinaPetrovic

1 Like

Hi Marina

thank you for help

for me didnt work cause i need to redirect to external thank you page from wp , could you help for this plz

thank you

thank you so much