Correcting image links after a WordPress migration
As we continue our tutorial series on migrating your WordPress site to Inmotion hosting, the next thing we want to cover is how to update the URLS for images within your pages and posts. They are coded differently so simply changing the site URL will not fix this. In this tutorial we show you how to fix this by using your phpMyAdmin tool.
Correcting image links after a migration
- Log into your cPanel interface.
- Once inside the cPanel, find the Databases category and click on the phpMyAdmin tool icon.
- You 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.
- This 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.
- Look to the top of the screen and you will see several tabs that run across the page. Click on the SQL tab.
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, '<old url>','<new url>'));
Be sure to replace <old_url> with the old sitename and <new_url> 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.
‹Section 4: Configuring WordPress After a Migration
›Section 6: Testing your WordPress website after Migration
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!
Migrating your Existing WordPress site to InMotion Hosting
2014-09-13 3:04 pm
I followed the instructions concerning image links after migration, however the images are still not being loaded when viewed in browsers. Can you offer any other instructions to assist?
2014-09-15 8:19 am
Right click on one of the missing images and get the image information from the menu there. This will include the URL where the program is looking for the image. Check to see that it is correct. If not, then run through the above again to change the URL. If it is still occurring we may need to take a look at files your account if you are one of our customers to see where the settings are incorrect.