Magento2 – How to Regenerate URL Rewrites in Store

magento2reindexurl-rewrite

While moving categories using the drag and drop feature in the Magento backend I somehow managed to corrupt my rewrites. The content in my url_rewrite table varies greatly from what it should be. It is as though my changes never updated the table correctly when my changes were made. It is completely unusable and my products are no longer showing on the frontend with the categories. In addition, my rerwites for the category pages themselves are instead showing the actual path instead of friendly URLs.

So, I believe that it would be a nightmare to try and repair the table manually and would likely run into key constraints.

Is there any way to delete ALL rewrites and regenerate them for my entire store?

I have tried re-indexing numerous times and I have also tried the iazel extension which did not do anything.

I do have the EmagicOne Store Manager and have deleted the entire contents of the my store from the web itself, then re-imported all products and categories from Store Manager and the products did show within the categories for a bit, but shortly after (without changes) they disappeared once again.

Now, I am looking for advice on how to resolve this issue.

Options as I see them:

  1. Destroy all products from the backend once again, but delete all rewrite data in the table this time, then re-import from Store Manager.
  2. Attempt the iazel extension again.

I have nearly 17k products.

Best Answer

You can delete all the URL rewrites with in mysql:

delete from url_rewrite;
delete from catalog_url_rewrite_product_category;

After which you can use iazel extension to regenerate the rewrites.

Warning:

Editing MySQL directly can be dangerous, so try it out on a local/development server before doing this on a production server.

Related Topic