I've used a script to TRUNCATE all tables related to products, so removing all products in my store. Now I want to remove the more than 4k URL rewrites related to those products removed, though, maintaining the categories' URL rewrites.

How can I do that?

1 Answer 1


To remove all URL rewrites related to the products, you can use that script SQL below.

DELETE FROM url_rewrite WHERE entity_type='product';

If you want just to remove the URL rewrites that were automatically generated, you can use this one.

DELETE FROM url_rewrite WHERE entity_type='product' AND is_autogenerated='1';
  • 1
    thanks for your help it helps me to resolve my issue Jul 18, 2020 at 8:20

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.