Images and links wrong after website move or domain change?

Sometimes it simply happens, that you need to migrate your website from one server to another, or from one domain to another.

Especially when you are changing the web hosting provider due some better conditions, or if you have your own company and you decided to change the name or domain. Migration of the website running on a WordPress content management system seems to be easy for the first sight.

Of course, when it comes to the testing of the website on the new location (domain or server), then it comes. All your links inside the posts, articles, pages, are wrong. Images are wrong, or there are even no images sometimes. You are asking yourself the question how this happened? The answer is simple – because when your website is quite large, it can simply happen. The database remembers the old links, old paths to images. But do not worry, there is always a solution, just follow these simple steps and you can fix this.

First think you what you should do is to login to your web hosting and go to your control panel. There is also a way to do this through the MySQL Workbench software, but I will explain you the solution through the web based control panel that most of the web hosting providers have.

  1. After login to the web hosting provider, in your control panel find the option “database management” or mostly the web base application “phpMyAdmin”. Click on it and allow the web application to load.
  2. You should be now now on the main phpMyAdmin page. Find the newly added database of your new website and click on its name from the sidebar on the left side.
  3. This will open the database and will display a list of the tables. Using the sidebar again, find and click on the wp-posts table.
  4. Now just look to the top of the screen and you will see several tabs that are across the page. Click on the SQL tab.
  5. You are now on a MySQL editor screen. Now copy the following bit of MySQL code and paste it into the code area:
UPDATE wp_posts SET post_content=(REPLACE (post_content, ','));


Be sure to replace with the old site name and with the new site name. For example, your old website domain was and your new one will be – your code should loook like this


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


Now you can simply click on the Go button and wait until the code runs. This will change all the URLs for all images in the posts, articles and pages of your website. The old images and links linked to the old domain will be overwritten to the new domain.

As I mentioned above, you can also use the MySQL Workbench software or any other software that you can install directly into your computer. The SQL code should be the same, but of course the look will be different than the web based phpMyAdmin mostly used by web hosting providers.

If you have some other experience, feel free to let me and others know by letting your comment below this article.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

I am sorry that this post was not useful for you!

Let me improve this post!

Tell me how I can improve this post?

Cite this text:
Jozef Kozár, PhD (July 15, 2024) Images and links wrong after website move or domain change?. Retrieved from
"Images and links wrong after website move or domain change?." Jozef Kozár, PhD - July 15, 2024,
Jozef Kozár, PhD December 23, 2020 Images and links wrong after website move or domain change?., viewed July 15, 2024,<>
Jozef Kozár, PhD - Images and links wrong after website move or domain change?. [Internet]. [Accessed July 15, 2024]. Available from:
"Images and links wrong after website move or domain change?." Jozef Kozár, PhD - Accessed July 15, 2024.
"Images and links wrong after website move or domain change?." Jozef Kozár, PhD [Online]. Available: [Accessed: July 15, 2024]
Avatar photo

Dr. Jozef Kozár

Author, Research Scientist, Consultant.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments for users from certain countries according to the current EU sanctions are blocked.

This site uses Akismet to reduce spam. Learn how your comment data is processed.