How to Correct Image Links After WordPress Migration
By Jithin on March 30th, 2017
WordPress is a flexible content management system. It allows you to update the Site URL as well as the Blog URL whenever you want. However, it only updates the dynamic URLs in your WordPress site. If you have uploaded the media files, it won’t update the URLs there. So, If you are changing the site URL after migration, your media files might throw you 404 not found errors.
If you have recently migrated your WordPress site from one domain to another and are facing 404 not found errors with media files, This tutorial is the solution. To solve this problem, we simply have to execute a MySQL query in PHPMyAdmin to update all the static URLs of the site. Static URLs are the URLs that are hardcoded into the tutorials. For example, the images given in this tutorial!
Let’s get started with the tutorial.
Correct Image link after WordPress Migration
1) Login to your cPanel interface.
2) Select the icon ‘phpMyAdmin’ under the ‘Database’ category.
3) After selecting phpMyAdmin page, find your newly added database, and click on the database.
4) It shows all the tables inside the database. Find the table ‘wp-posts’ from the list of tables.
5) Click on ‘SQL’ tab from the top of the screen.
6) Now it displays a MySQL editor screen. Copy the following query to the code area.
UPDATE wp_posts SET post_content=(REPLACE (post_content, '<old url>','<new url>'));
Please be sure to replace <old url> with the old site name and <new url> with the new site name. Then click on the ‘GO’ button to run the query. After the query execution is complete, all posts and images will be updated with new site URL.
We hope this tutorial was helpful for you. If you have any questions regarding this topic, please let us know in the comment section given below. If you are an active InterServer customer, feel free to contact our awesome support staff for quick help!