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:


This is not for all products.

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

  • Please do reindex and test in incognito window (private window). – Nalin Savaliya Apr 13 '18 at 11:27
  • I have done Reindexing, flush cache also – Vinod Kumar Apr 13 '18 at 11:33
  • I had fixed the same issue today in M2.3.2 – Hassan Ali Shahzad Feb 2 at 11:53
  • You can use this module to regenerate the Product URLs github.com/Iazel/magento2-regenurl – Kishor Thummar Feb 3 at 4:03
  • @VinodKumar you also check product visibility which I mention in below. – Msquare Feb 5 at 14:06

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


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.

| improve this answer | |

You can try/use Regenerate a Url rewrites extension.

The extension allows you to regenerate a Url rewrites of products and categories.

1 > Run command to re-generate Url rewrites for all categories/products for all stores:

php bin/magento ok:urlrewrites:regenerate

2 > To regenerate Url rewrites for specific store view (e.g.: store view id is "1"):

php bin/magento ok:urlrewrites:regenerate 1
| improve this answer | |
  • This is really pathetic plugin take too much time but generate nothing – Hassan Ali Shahzad Feb 4 at 14:30
  • To the contrary, I've had good experiences using this module quite a few times. It could work in this instance and not work in some others. – Rhys - SproutDesk Feb 4 at 17:49

Try this

Marketing > url rewrite > new url rewirte

Request Path "product-url-key"

Target Path "catalog/product/view/id/2221"

Redirect Type "no"

Save and flush cache


Marketing > url rewrite

search with the "product-url-key" in Request path there you will get some idea.

Hope it might help

| improve this answer | |

Try this:-

Solution 1-

  • Marketing->URL Rewrite search the URL and edit the Request Path. OR you also can do this from database
  • Go to the database select the url_rewrite table search with the "product-url-key" in and change the request_path of the product.

Solution 2-

  • Go to the database select the url_rewrite table search with the "product-url-key" in and delete the URL then go to the product and save, it will auto-generate the product URL.
| improve this answer | |
  • so if user have 100k products so he have to spent 5000 hours approximately to update products one by one. – Hassan Ali Shahzad Feb 2 at 11:56
  • No, in that case, delete all the product URL from url_rewrite and go to catalog>category and save the category one by one it will auto-generate the product URL. – Rishi Ranjan Feb 4 at 5:54
  • It will not generate try it for your satisfaction. – Hassan Ali Shahzad Feb 4 at 14:27
  • this was possible in M1 but not in M2 on which version you try it ? – Hassan Ali Shahzad Feb 5 at 12:07
  • I am using Magento 2.3.3, you have to change little bit URL of your main category and save, again correct the URL as previous and save again it will auto-generate URL – Rishi Ranjan Feb 6 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.