Product Link broken when using query vendors?q=

Topic summary

Main issue: Product URLs break when accessed from a vendor-filtered collection page in Shopify. After making URLs more SEO-friendly (collections/collection-name/products/product-name), clicking a vendor link (collections/vendors?q=apple) generates product links like collections/vendors?q=apple/products/product-name, which is invalid.

Context: The vendor page uses a query parameter (q) to filter by vendor, but the product link inherits that path segment, causing a malformed URL.

Technical notes:

  • SEO = Search Engine Optimization.
  • q is a query parameter used to filter vendors.
  • Liquid is Shopify’s templating language.

Proposed solution: Use the Liquid filter {{ product.url | within: collection }} to construct product links within the current collection context, yielding the correct format: collections/collection_name/products/product_name.

Status: A concrete fix was suggested; no confirmation yet from the original poster. No images or code snippets beyond the Liquid tag are central.

Summarized with AI on December 24. AI used: gpt-5.

Hi! I’ve came into a problem with URL Structure, by default shopify URL goes like abc.com/products/apple-malt , for making it SEO friendly i’ve changed it to abc.com/collections/juices/products/apple-malt. But, the problem is that when someone clicks the vendor of the product the link open a collection page of that vendor by query which goes like abc.com/collections/vendors?q=apple and when you open a product from this page the URL further changes to something like this abc.com/collections/vendors?q=apple/products/apple-malt and the product link is broken because of it.

Hello @M_Awais

If You need it like this? → collections/collection_name/products/product_name

USE: {{ product.url | within: collection }} as a redirection.

Thank You

1 Like