4

I've migrated my store from version 1.9 to 2.1.1 using a tool.

However all the old products are appending html.html at the end of the URL. I basically truncate the url_rewrite table and saved all the categories. That created new URLs.

It looked good for few days, but now slowly I am noticing that some URLs are changing again to html.html.

This is not good for any business. It looks like when I create a new category or edit an existing category, all the products are being affected.

The new products entered into 2.1.1 are not affected by this bug — only the old ones I migrated from 1.9.

2
  • Hi @roger, what tool do you used, can you provide and example of the Urls being affected? You can replace the domain name to keep it private if you want. Commented Jul 29, 2017 at 2:13
  • ubertheme.com/magento-news/magento-2-data-migration-tool Commented Aug 7, 2017 at 20:53

1 Answer 1

1

The thing is your product's url_key and url_path have .html in them.

Here is what I did to get rid of that problem.

Warning: If your links have been having .html.html for some time they've probably already got indexed by google. To avoid loosing any traffic make sure you redirect .html.html to .html with your web server after you apply my fix.

Login to your DB and issue the following commands:

UPDATE catalog_product_entity_varchar
 SET value=replace(value,'.html','') WHERE attribute_id IN
  (SELECT attribute_id FROM eav_attribute
    WHERE attribute_code in ('url_key','url_path') AND entity_type_id =
     (SELECT entity_type_id FROM eav_entity_type WHERE 
      entity_type_code='catalog_product'));

DELETE FROM url_rewrite WHERE target_path LIKE "%.html.html%";

UPDATE IGNORE url_rewrite SET request_path = REPLACE(request_path, '.html.html', '.html');

Then reindex the database:

php bin/magento indexer:reindex

And the issue should be fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.