Question

On my site, during the development process, products were created and imported using a variety of processes. Now I find that the URL rewrites are not uniform and don't seem to work in all cases.

Some products rewrite/redirect correctly, and some do not rewrite/redirect at all. In these cases, even though there are url_keys stored in the products, the rewrite part doesn't seem to be happening.

Since the site is still in developmnet, I don't need to preserve any old rewrites or any custom ones. I'd really like to clear them all out and regenerate them all based on the current product names.

In CE, I would truncate the core_url_rewrite table and reindex, and that would take care of things. I am not sure if this is possible in the Enterprise edition. Is there a similar process/procedure that I can use to recreate the rewrites and make the products use the rewrites? I have seen similar problems involving 1.13 and write-ups about fixing similar behaviors, but I'm not comfortable working with instructions that are 2-3 years old and for versions of Magento that are 2-3 back.

UPDATE:

I ran this MySQL query to remove all URL Rewrites:

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `enterprise_url_rewrite_redirect_rewrite`;
TRUNCATE TABLE `enterprise_url_rewrite_redirect_cl`;
TRUNCATE TABLE `enterprise_url_rewrite_redirect`;
TRUNCATE TABLE `enterprise_url_rewrite_product_cl`;
TRUNCATE TABLE `enterprise_url_rewrite_category_cl`;
TRUNCATE TABLE `enterprise_url_rewrite`;
TRUNCATE TABLE `enterprise_catalog_product_rewrite`;
TRUNCATE TABLE `enterprise_catalog_category_rewrite`;
TRUNCATE TABLE `core_url_rewrite`;
SET FOREIGN_KEY_CHECKS = 1;

Then reindex all from command line...

That helped a lot, but I still see some products that have a url_key assigned, but don't seem to have an associated rewrite in the database.

In the frontend, I see: http://dev.xxxx.com/catalog/product/view/id/8573/

instead of: http://dev.xxxx.com/my-really-cool-product/

where the value "my-really-cool-product" is the value of the product "url_key".

Was it helpful?

Solution

I got this patch from Magento Support:

SUPEE-7854 (New products and categories will not display on front end unless we reindex all) NOTE: This patch includes the fix from SUPEE-7345 --- URL Keys are in incorrect, non-SEO format

Which I installed, and then flushed the URL redirect tables as specified above, and reindexed.

The patch and reindexing fixed the issue of the broken redirects, (or rather created redirects for those products that before were missing them) but it also seemed that the existing "good" redirects were broken by the deletion of the "url_key" for those products.

I opened each affected products and immediately saved them again to re-generate new "url_key" values. (It might have been a good place to automate the process, but due to the relatively small number of affected products, I chose to just do it "manually".) Now all products are now behaving as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top