We have recently migrated Magento1 to Magento2.we found that url_rewrite table has almost 16000000+ rows. M1 site was build before 6 years and the url rewrite table has increased over the years. This website has around 6000+ categories and 8000+ products.

Is there a good article or process that we can optimize this table to increase the performance. We want to make sure we do not lose any SEO URLs.

Thank you

  • Hey, backup the database, if you keep categories and products names the same it will generate them with the same paths, try delete them all and generate them again so you stay only with the ones needed and not lots of ones magento don't even use. To generate we usually use github.com/olegkoval/magento2-regenerate_url_rewrites but there is other options. I don't think there is any way to optimize it better than delete all the unneeded entries. Make sure you backup that table at least in case something goes wrong. Hope it helps a bit
    – Rui Silva
    Commented Dec 22, 2020 at 11:06

1 Answer 1


Take backup of site first

Open phpmyadmin and search for url rewrite table and truncate it ( Please make sure you have uncheck foreign key checkbox )

Then install extension follow instruction to remove all unnecessary rewrite which is not useful

Please follow this link https://github.com/elgentos/regenerate-catalog-urls

For more info https://magento.stackexchange.com/a/166507/77554

Happy coding

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.