0

I recently migrated a live wordpress site, watershedgeo.com, over to a development site using the temp url, http://vps3813.inmotionhosting.com/~watershedgeo/dev.watershedgeo.com/.

I finally got it launched but the images and links don't show, they're all broken, but a lot of the images are showing their alt text. Here's the weird thing:

If I inspect the images in chrome, they show the temp url as the src of the image, but if I change the root before wp-content to watershedgeo.com, they show up. However, if I inspect the images on the live site, they show the source as http://1qy8tt40p7n9v7tao3knw537.wpengine.netdna-cdn.com/wp-content/uploads/2016/04/imageName

Is there a plugin or a way that I can change it so all the images use 1qy8tt40p7n9v7tao3knw537.wpengine.netdna-cdn.com as the root so the images can show for development? All folders match, it's just the root that needs to be changed

The temp url is what is in the site url for the database and the wp-config.php file.

12
  • The real question is what are the image URLs in the database? Have you got access to PHPmyAdmin or can you connect to the database with SQLYog?
    – Daniel
    Commented Aug 21, 2017 at 18:02
  • Yes I'm in phpmyadmin. WOuld this be the GUID in wp_posts, or somewhere else?
    – H.Norman
    Commented Aug 21, 2017 at 18:05
  • Look at one of the posts with this issue, get the post ID from the wp-admin and then go to the wp_posts table, copy the text from the wp_content field and paste it into a text editor. Once you've done that you should be able to see where wordpress expects the images to be. Then you can use a find & replace tool to update those references
    – Daniel
    Commented Aug 21, 2017 at 18:09
  • But it's not just for posts, it's just general images on the home page. even the logo
    – H.Norman
    Commented Aug 21, 2017 at 18:14
  • For instance, it's looking for an image at vps3813.inmotionhosting.com/~watershedgeo/dev.watershedgeo.com/… but if I change the src on the front end with chrome inspector and replace everything before wp-content with 'watershedgeo.com' the image shows up
    – H.Norman
    Commented Aug 21, 2017 at 18:17

2 Answers 2

1

Although you can use phpMyAdmin to dig into the database to change things, I always use the WP Clone plugin to easily move a site from development to production. Install the plugin on both source and target systems, then backup the source, and restore to the target. It's here https://wordpress.org/plugins/wp-clone-by-wp-academy/ .

Everything is moved for you, with URL adjustments, and other stuff done for you. Easy peasy.

Of course, you can do it more 'manually', but the plugin works well and fast for me (being somewhat lazy).

1

Here is the answer on their doc site, "Correcting Image Links After Migration":

Here's my copy and paste of the post, but you're better off reading the original post I linked to above.

Log into your cPanel interface. Select phpmyadmin toolOnce inside the cPanel, find the Databases category and click on the phpMyAdmin tool icon. select new databaseYou are now on the main phpMyAdmin page. Find the newly added database and click on its name from the left-hand sidebar. Our sample database is named testdb.

Select database tableThis opens the database and the screen refreshes with a list of the tables. Using the sidebar again, find and click on the wp-posts table.

Click the SQL buttonLook to the top of the screen and you will see several tabs that run across the page. Click on the SQL tab. enter the SQL code and run it

You are now on a MySQL editor screen. In the code area, copy the following bit of MySQL.

UPDATE wp_posts SET post_content=(REPLACE (post_content, '',''));

Be sure to replace with the old sitename and with the new site name. For instance, our original site was inmotiontesting.com and the new test site will be at test.inmotiontesting.com so the code should appear as below:

UPDATE wp_posts SET post_content=(REPLACE (post_content, 'inmotiontesting.com','test.inmotiontesting.com'));

Click on the Go button to run the code and change the URLs for all images in the posts. This will also affect any other 'hard coded' links that were in the posts that pointed to the original site.

Below are before and after shots of the changes made. Note that the image paths are displayed in the lower left hand corners of the images. You can see how they switched to the new sitename after the SQL code ran.

5
  • I had done this previously per their documentation but it didn't help with the images themselves because not all are in posts. A lot of the images are linked directly in the page builder for Avada theme in wordpress > pages
    – H.Norman
    Commented Aug 21, 2017 at 18:37
  • I see. I've used Avada theme, do their docs provide any help? Commented Aug 21, 2017 at 18:37
  • Years ago they recommended exporting it and updating all links there, then reimporting it to the db. Seems clunky, but could work: theme-fusion.com/forums/topic/… Commented Aug 21, 2017 at 18:40
  • Also have you done any of these steps? inmotionhosting.com/support/edu/wordpress/… so you can use the temporary url? Don't do it, probably best bet is to edit the urls out of the database, but I just want to check what else you may have done. Commented Aug 21, 2017 at 18:45
  • Nice! The site's images are now loading. Commented Aug 21, 2017 at 19:06

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.