How to Correct Image Links After WordPress Migration

By 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.

Image Links

 

3) After selecting phpMyAdmin page, find your newly added database, and click on the database.

Image Links

 

4) It shows all the tables inside the database. Find the table ‘wp-posts’ from the list of tables.

Image Links

 

5) Click on ‘SQL’ tab from the top of the screen.

Image Links

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>'));

Image Links

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!

4 Responses to “How to Correct Image Links After WordPress Migration”

  1. Abu Monsur says:

    Cordial thanks for the tips on fixing image link. Because of domain change some images were missing. So I have been greatly benefited by your nice tips.

    Thank you
    Abu Monsur

  2. Renate says:

    this worked like magic!!! i did have to change wp_ into my own table prefix because mine is not standard. But then it worked like a charm. Over 700 links changed and my images are back. thank you so much

Leave a Reply