0

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

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

5 Answers 5

2
+100

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.

1

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
2
  • This is really pathetic plugin take too much time but generate nothing Feb 4, 2020 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. Feb 4, 2020 at 17:49
0

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

Or

Marketing > url rewrite

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

Hope it might help

0

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.
6
  • so if user have 100k products so he have to spent 5000 hours approximately to update products one by one. Feb 2, 2020 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. Feb 4, 2020 at 5:54
  • It will not generate try it for your satisfaction. Feb 4, 2020 at 14:27
  • this was possible in M1 but not in M2 on which version you try it ? Feb 5, 2020 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 Feb 6, 2020 at 5:28
0

You can just use default magento feature URL rewrites for your concern

Marketing->SEO & Search->URL rewite

here you can create new rule for your particular URL. eg:

  1. request path->http://www.test.com/product-url-key.html
  2. target path->http://www.test.com/catalog/product/view/id/2221/product-url-key

and you will good to go.

dont forget to reindex and flush.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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