Magento – Reset URL Keys for All Products to Use Default for All Store Views

product-urlsurl-rewrite

I've got 2 store views, recently I noticed that for some reason (either by design or by a bug) that each product has a unique URL KEY for both store views.

It is setup in the following way:

  • Default Store
  • English
  • French

I need to reset all products for English and French to use the Default Store view URL key.

The store is separated by /eng and /fr so there is no reason to have a unique url key.

There are 2 ways I thought of doing this:

  1. Run a MySQl Statement to delete all the keys and set back to use default:

    delete from catalog_product_entity_varchar where attribute_id = 97 and store_id != 0

But it doesn't address the fact that if more products are modified, it will continue to create new keys.

  1. Another way I thought of doing this was to force the URL Key to be a [GLOBAL] attribute and not [STORE VIEW] But I dont know if this is possible or if this would be the best approach.

What is the best way to set all my existing products to use the Default store view URL Key and prevent this from happening to new products?

Is this normal Magento behavior?

Best Answer

No, this is not default behavior, the reason of this might be in the method you are using for modifying your products/creating new ones. I assume you are not doing it via admin, otherwise you wouldn't have this issue unless you want to. It will depend upon the import method you are using.

Related Topic