Magento – Some products have catalog/product/view/id/2221/name-of-the-product from product URL magento 2

magento-2.1.8magento2.3.3productproduct-urlsurl-key

In the Site, product URL is like this: http://www.test.com/product-url-key

But when I searching the product then some product URLs are showing like this:

http://www.test.com/catalog/product/view/id/2221/product-url-key

This is not for all products.

i want to url like this type http://www.test.com/product-url-key.html

Best Answer

Note: Please take a backup of the database

To resolve this issue first delete the rows from the "url_rewrite" table which has 'product' as 'entity_type'. You can use below query

DELETE FROM `url_rewrite` where entity_type='product'

Then install below the extension

https://github.com/olegkoval/magento2-regenerate_url_rewrites

and run the below command.

php bin/magento ok:urlrewrites:regenerate --entity-type=product

This solution is worked for me, Hopefully, this will help you.

Related Topic