Solved

How to change the Shopify URL Structure

XJoseph
Shopify Partner
23 0 0

Hi Support,

Please help me about URL Structure please give me any code any solution how can i do this, like sub-collection
i want it that way : www.abc.com/collections/socks/products/pink-socks

Thanks

 
Accepted Solution (1)

Shay
Shopify Staff
2837 442 578

This is an accepted solution.

Hi @XJoseph 

 

When hosting your website on Shopify, you cannot change the URL structure of your webpages. I recognize why you may wish to make this change, but it isn't something we support at this time. I will be happy to share this feedback with our developers though for further consideration. 

Shay | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 5 (5)

tim
Shopify Expert
3329 254 1201

Most themes use this URL structure when you go to a product page from the collection page.

It's done by using https://shopify.dev/docs/api/liquid/filters#within 

 

Sometimes people want to always use /products/XXXX URLs for SEO reasons -- to have single URL pointing to a product page -- when product belongs to 10 collections there are at least 10+1 URLs pointing to the product page.

Your theme may have already been modified to do so.

 

If you go to product page directly from homepage or other page, or from search results the URL will be different.

In part -- because a product can belong to several collections and there is no notion of "main" product collection.

 

This can be changed with some theme coding and metafields, but anyways it's at most single collection (you can't do /collections/socks/cotton/pink-socks (unless headless)).

 

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.

Shay
Shopify Staff
2837 442 578

This is an accepted solution.

Hi @XJoseph 

 

When hosting your website on Shopify, you cannot change the URL structure of your webpages. I recognize why you may wish to make this change, but it isn't something we support at this time. I will be happy to share this feedback with our developers though for further consideration. 

Shay | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

XJoseph
Shopify Partner
23 0 0

Hi @Shay 
Thanks for your updated i really appreciate 

PalMultimedia
Shopify Partner
1 0 0

I am in favour to have control with URL & URL structures. Specially when migrating stores from other platform, keeping same URLs help to eliminate any SEO -URL issues.

Sarveshtech
Shopify Partner
6 1 2

i got the sollution go to this file : product-card.liquid
then replace this code : <a class="card-title link-underline{% if settings.product_title_line_text != 'full' %} card-title-ellipsis{% endif %}{% if variant_selected != blank %} card-title-change{% endif %}" href="{{ product_card_product.url }}" data-product-title="{{ product_card_product.title | escape }}" data-product-url="{{ product_card_product.url }}">
to this code :     

{%- liquid
...
assign product_url = product_card_product.url | split: '?' | first
assign collection_url = product_card_product.collections.first.url | split: '?' | first
-%}
...

<a class="card-title link-underline{% if settings.product_title_line_text != 'full' %} card-title-ellipsis{% endif %}{% if variant_selected != blank %} card-title-change{% endif %}" href="{{ collection_url }}{{ product_url }}" data-product-title="{{ product_card_product.title | escape }}" data-product-url="{{ collection_url }}{{ product_url }}">


by using above code you can change the url structure in this way www.abc.com/collections/socks/products/pink-socks