How can I redirect a valid URL to another on my website?

Topic summary

Main issue: Redirect /collections/iphone/ to /collections/iphone/iphone-13 on a Shopify store. Shopify’s built-in URL redirects won’t apply because the source is a valid, existing collection URL.

Workaround proposed: Modify theme code to conditionally handle that collection.

  • File: main-collection-product-grid.liquid
  • Add a conditional block: if collection.handle == ‘iphone’ and current_tags == blank
  • This targets the iPhone collection when no tag filters are applied, allowing theme-level logic to route users or adjust output as desired.

Key terms:

  • Liquid: Shopify’s templating language for theme files.
  • collection.handle: The unique identifier for a collection used in templates.
  • current_tags: The set of active tag filters on a collection page; blank means no filters.

Outcome: The original poster confirmed the solution worked.

Notes: A screenshot was provided to show where to insert the code in the template. Discussion reached resolution; no further questions were raised.

Summarized with AI on February 10. AI used: gpt-5.

Looking to redirect this URL:

https://stylcase.com/collections/iphone/

To this URL:

https://stylcase.com/collections/iphone/iphone-13

But because it’s a valid URL Shopify won’t do it, anyone know a workaround?

1 Like

Hi @styl ,

Please go to main-collection-product-grid.liquid file and add code here:

Code:

{% if collection.handle == 'iphone' and current_tags == blank %}
  
{% endif %}

Hope it helps!

1 Like

Perfect thank you!

1 Like