Magento – Magento 2 is generating the product url with catalog/product/view/id instead of product name

magento2product-urlsurlurl-rewrite

We are having a strange problem in our Magento 2 webshop. Our webshop has different ways of generating the product url. So some of our products just show the product url as it should be /name-of-the-product and others show it with the following structure:

domain.com/catalog/product/view/id/2221/name-of-the-product

And then we have a third way and that is that it includes the category id in the url like:

domain.com/catalog/product/view/id/5856/s/name-of-the-product/category/899

We would all products like to be just with the name of the product so:

domain.com/name-of-the-product

We tried setting up the search engine optimization settings by configuration / catalog / catalog as shown in the first answer and shown in the image blow, but this did not work:

enter image description here

We also tried setting up the search engine settings by configuration / general / web / Search engine optimization as shown in the printscreen below, but this also does not work.

enter image description here

You can see what is happening on https://www.loungeset.nl/accessoires/tuinmeubelhoes. If you scroll a bit down to for instance to AeroCover bbq hoes ΓΈ52cm – antraciet you see what is happening

Has anyone a idea how this comes?

Best Answer

In case anyone else has this issue, I had the same and the above didn't work for me either. The issue is caused by duplicate url keys being generated from products with the same name. I used this module https://www.cadence-labs.com/2017/11/magento-2-fix-duplicate-url-key-for-categories-and-products/ to change all of the duplicate url keys and then ran the olegkoval regenerate url rewrites module afterwards and this fixed the issue.

Hope this helps someone else who is facing the same problem!