4

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?

2 Answers 2

12

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
  • 1
    thanks for your help it helps me to resolve my issue Jul 18, 2020 at 8:20
0
delete from url_rewrite where 1=1;
ALTER TABLE url_rewrite AUTO_INCREMENT = 1;

and then re-index

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.