1

We are just in the process of upgrading Magento EE from 1.12 to 1.13.1 and we've hit a little snag on the url rewrites that are automatically generated from the migration script.

We run 3 different store views and most of the products are replicated through each, for example:

  • www.storename.com/mens/product.html
  • www.storename.com.au/mens/product.html
  • www.storename.co.uk/mens/product.html

However after running the url migration script all these URLS have switched on the front-end and now display like:

  • www.storename.com/mens/product-1.html
  • www.storename.com.au/mens/product-2.html
  • www.storename.co.uk/mens/product-3.html

I'm sure this has something to do with the system identifying these as duplicates and therefore adding -1,-2,-3 to each of the corresponding URLS.

What would be the best way to fix this? We cannot continue the upgrade because this will cause a SEO nightmare as all the URLS like /product.html will 301 to /product-1.html and so forth.

0

This usually happens when a URL key being imported already exists in the URL rewrites, resulting in incremental integers being added at the end. URL keys, which are indexed from the _url_key tables are constrained to be unique. Prior to EE 1.13, you would also sometimes get the entity IDs appended for some reason. I have not seen this particular behavior on EE 1.13 yet.

To resolve your problem, you basically need to reset your URL rewrites with the following series of queries.

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

I have done this previously, and it work without affecting anything else, as long as you don't have custom rewrites. Please note that this will remove all of the URL rewrites, including system ones (like ones your mentioned) and custom URLs, which have enterprise_url_rewrite.system = 0.

See this question as well for more information.

  • Thanks for your detailed answer, unfortunately we do have a lot of custom URL rewrites for landing pages and a few others. I'll try the above on my local dev and see the results, if it does work it may be worth re-adding the rewrites for custom pages. Thanks, – dmcckmd Feb 9 '14 at 18:47
  • Alright, so I truncated those tables, then ran the indexer from the command line php indexer.php --reindex all With no success, so I ran the truncate again but also including enterprise_url_rewrite_redirect, then reindexed in the following order by using: php indexer.php --reindex catalog_url_category, catalog_url_product, catalog_url, url_redirect. With no success, but this time its removed all custom url rewrites but that was expected. – dmcckmd Feb 9 '14 at 20:10
  • When you say no success, what do you exactly mean? Note that the rewrites are in enterprise_url_rewrite and not in core_url_rewrite for EE. – musicliftsme Feb 10 '14 at 14:51
  • Well it didn't fix the problem with the URLS hyphenating, its still displaying as product-name-1.html instead of product-name.html – dmcckmd Feb 10 '14 at 22:09
  • If you've certain that the records in enterprise_url_rewrite were repopulated from the indexing, then I'm guessing you have more than two request_paths with the same url keys, product-name. Run SELECT * FROM enterprise_url_rewrite WHERE request_path LIKE 'product-name%' and see if you get more than one returned result. These must be unique. – musicliftsme Feb 10 '14 at 22:31
0

After some digging, this solved our issue:

DELETE url_table
FROM catalog_product_entity_url_key url_table
INNER JOIN catalog_product_entity_varchar old_url_table ON url_table.store_id = old_url_table.store_id
AND url_table.store_id <>0
AND old_url_table.store_id <>0
AND url_table.attribute_id = old_url_table.attribute_id
AND url_table.entity_id = old_url_table.entity_id;

Then re-running a reindex on the whole site, fixes the issue with -1's -2's etc... credit for this fix goes to this page: http://www.code4business.de/update-magento-enterprise-edition-1-13-0-2/#more-1144

  • Wait a second, are you implying you did not re-index after you ran the set of queries I put provided? – musicliftsme Feb 13 '14 at 23:38
  • We did reindex after your set of queries but it still had the leftover -1 -2 -3's, running the above solved it. – dmcckmd Feb 14 '14 at 1:52

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.