Ας "μιλήσουμε" για WordPress. After merging its database iguru.gr in the iguru database, all the image links pointed to the iguru.gr directories. For example:
https://cdn.iguru.gr/wp-content/uploads/2016/10/Mechanic.jpg
So although there were the publications in iguru the pictures they kept coming from iguru. So after moving all the files from iguru's /uploads to iguru's dir of the same name, we had to bulk change the URLs to get the images from:
https://cdn.iguru.gr/wp-content/uploads/
Let's see how it's easy to do (make a backup of your database before trying it):
Below are the SQL commands we used to change URLs across the database.
UPDATE wp_options SET option_value = replace (option_value, 'https://iguru.gr/wp-content/uploads/files',' https://iguru.gr/wp-content/uploads/files') WHERE option_name = 'home 'OR option_name =' siteurl ';
UPDATE wp_posts SET guid = replace (guid, 'https://iguru.gr/wp-content/uploads/files','https://iguru.gr/wp-content/uploads/files');
UPDATE wp_posts SET post_content = replace (post_content, 'https://iguru.gr/wp-content/uploads/files', 'https://iguru.gr/wp-content/uploads/files');
UPDATE wp_postmeta SET meta_value = replace (meta_value, 'https: //iguru.gr/wp-content/uploads/files','https: //iguru.gr/wp-content/uploads/files');