cancel
Showing results for 
Search instead for 
Did you mean: 

Force category structure in url

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Force category structure in url

Hi,

 

I am able to access a product from two urls, eg:

domain.com/heart-fine-ruby-edge-ring

domain.com/collections/heart-rings/heart-fine-ruby-edge-ring

 

The second url has the category structure in it, Is there a way that magento2 will always force this and that the first url is not generated?

 

Thanks in advance!

1 REPLY 1

Re: Force category structure in url

Hi @dave_lynch1

 

I understand the problem you are facing !

 

Forcing category URL from the navigation menu is possible - like you need to enable option from the magento 2 backend -  Admin -> Stores -> Configuration -> Catalog -> Search Engine Optimization -> Use Categories Path for Product URLs -> Yes

 

But in this case also first url will always generate in backend and database - as magento generate url rewrite for all the hierarchy like single product url to nested categories URL along with its path as well.

 

Also i would suggest you to don't change it, as it is for seo purpose.

 

still for more reference refer this link - https://magento.stackexchange.com/questions/224848/how-to-remove-direct-product-url-in-magento-2?rq=...

 

Hope it helps!

if issue solved,Click Kudos & Accept as Solution