Magento 2 – How to Delete and Regenerate URL Rewrites

magento2url-rewrite

I have recently created 2 additional store view on magento 2 store.
Now the url of category and Products are not for those stores is not proper

Eg: http://example.com/catalog/category/view/s/pouches/id/20/
which is suppose to be http://example.com/accessories/pouches.html

Now when I save each product and category one by one it regenerate url rewrite for that product or category.

But there are lots of products and category.

So is there any way to regenerate URL rewrite

as in Magento 1.x it can be done via reindexing.

Best Answer

This module is been deprecated you can use this module instead

Download Using Composer;

composer require elgentos/regenerate-catalog-urls

php bin/magento setup:upgrade

Regenerate url for all products and the global store

php bin/magento regenerate:product:url

Regenerate url for products with id (1, 2, 3, 4) for store 1

php bin/magento regenerate:product:url -s1 1 2 3 4