0

This is my first time asking a question so here goes. I have recently moved my Localhost magento 2 site to a live server. Everything works great but I have a problem and was hoping to find a solution. I have many products and I have added Images in Magento Product Content Description, problem is all the image urls are http://localhost/example/pub/media/wysiwyg...Is there a way to change all of them to my live site eg https://example.com/pub/media/wysiwg...without having to go through each one individually?

So change the localhost urls http://localhost/example/pub/media/wysiwyg...to live server urls https://example.com/pub/media/wysiwyg....etc?

2 Answers 2

0

If found an alternative way to fix this that worked for me so if anyone is facing this problem this worked for me.

If you are able to export your database then do so and remember to make a backup. Open with sublime text or whatever program you prefer and do a find all and replace all, then import the database. Worked for me..

0

In MySQL

get description attribute id, most likely 75

SELECT * from eav_attribute where attribute_code = 'description' and entity_type_id = 4;

then bulk update description value with replace

update catalog_product_entity_text set value = replace(value, 'localhost', 'example.com') where attribute_id = 75

Flush cache and you are done!

3
  • Thanks for the reply, that does not work, i get a error when running "get description attribute id "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'eav_attribute where attribute_code = 'description' and entity_type_id = 4' at line 1"
    – Adrian
    Commented Jul 1, 2021 at 15:18
  • ah, I missed keyword "from" in the first query, see updated.
    – Ryan Sun
    Commented Jul 1, 2021 at 18:02
  • Ok ive tried that and it doesnt work either, still get an error just a different one, (An expression was expected. (near "from" at position 7) But I have figured out an alternative way thanks though
    – Adrian
    Commented Jul 2, 2021 at 13:00

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.