The WordPress migration process can be easy if you follow some basic tips and rules to avoid errors. But sometimes, the WordPress images will not show up again after a migration, and that’s a problem to solve in easy steps.
First, let’s understand why these images are broken after moving a blog to a new server or hosting.
If you’ve just moved the blog files, but without changing the domain name, then, the problem was caused by missed images really, and the folder that contains these images is broken and you need to re-upload the folder manually.
In other cases, where you change the domain name of your blog, you need to replace all the old database URLs with the new ones. I’ll show you how to fix the problem in the following tutorial.
Images not showing after moving WordPress
Please note, I suppose all the cases, and I will show you how to solve each one of them. So, read the exact case that you have, or follow them, one by one.
1. Migration with the same domain
If you have moved the blog or website files to a new location, but with the same domain name, then, the problem can be caused by the “Uploads” folder itself, or a specific file inside it, and it’s the exact “month file”.
If you’re using one of the plugins that detect broken links, you can easily find the exact folder. Just see what is the month that is associated with the image URL.
In this case, you can see that the month is “05” and you need to verify that exact file. So login to your cPanel account, and then, click on the File Manager icon as the following screenshot.
Now, you have the blog files and you have to find the one called “wp-content” that contains the “Uploads” folder as the next screenshot.
Now, you can see “every month” as it’s shown next.
If you can see these months, then, the problem is one of these two cases:
- The files are broken, or not existing and you should re-upload them manually (as below).
- The file permissions are wrong, in this case, you have to select the files one by one, and click on “Change Permissions” at the top of the page, and make them 755 or 777 if that can’t help.
1. Upload the broken, or not existed image files
When you migrate a blog, it happens that a brief connection issue can break the entire folder, and especially for images. What you need is to have the “Uploads” folder in your computer from a backup, or an existing folder, on your old hosting server.
What we want to do is to replace that folder with another one that’s working. Please make sure to remember that the folder contains all the blog images, and uploaded files before you’ve migrated.
Then, use the cPanel and click, “wp-content” as the above examples and delete the file “Upload” and upload another one like this example.
If you can’t upload the entire folder, you can upload the individual sub-folder that are the “months”, one by one, and make them in the exact order as the old folder, the same years and the same months.
If you’ve followed the above steps, and you have the same domain name, the WordPress blog images should work again, and you need to delete the blog cache if you’re using it, and the browser also.
Or, change the browser for better verification. If it’s not the case, and you still see broken images, see the below case where the issue was caused by the file permissions.
2. Change the file permissions
Some hosting servers can be configured with strict settings by default. If you get permissions errors in your images, and similar cases, then, all you have to do is to change the permissions, by selecting a file, or all of them, and then click on “Change Permissions”.
A small pop-up window will be shown, and you need to check the boxes to make them “755” or “777” if that doesn’t work.
When you finish with the files that cause the problem, come back to your blog, and delete the cache if you’re using a caching plugin, and also, visit your posts to see if all is working properly.
2. Images not showing after moving a blog to a different domain or directory
This is another case, where you change the blog URL address completely.
(Example: www.oldblog.com to www.newblog.com).
Or you move it to another directory, in the same server, or in a different hosting also.
(Example: moving the blog from
www.yourblog.com/wp to the new one
www.yourblog.com or vice versa).
The problem is this, your old images are still pointing to the old URL, and that’s normal. In this case, you should update all the old blog URL with the new ones, and that’s can be done by 3 methods:
a/ Using a plugin
The first one is using the plugin Search and Replace, after activating it, you will find the plugin under “Tools” in your WordPress dashboard. It’s similar to the old plugin that’s gone now.
Then, you can replace all the old URL addresses, and make them point to the new URL of the domain name.
Also, you can use the plugin options to find a specific database table if you want. But, in general, you need to search the old URLs and make them the new blog address. Check the box” All-search/replace!” when you’re sure and you find the old URLs.
Please make sure that you’ve entered the exact new blog URL. At the same time save a copy of your database if something wrong happens. This process will modify the database tables, and you should be sure when you enter the Url.
b/ using an online tool
If your SQL database file is less than 5 MB in size, then, you can upload it to the Search and Replace, and add the old and the new domains, and the tool will make the necessary changes. Then, you can download your corrected database, and use it on the new server.
C/ using SQL query
The second option that I recommend only for advanced users is to open your phpMyAdmin interface and just run the next SQL query. But first, you should definitely make a backup of your full database because if you do the code the wrong way. So download a backup of your site database to use it later for restoration if needed.
UPDATE wp_posts set post_content=REPLACE(post_content, 'www.oldblog.com/', 'www.newblog.com/');
Then, the blog images will work again. The above solutions will solve your problem if the server is working properly, and there is nothing wrong with its configuration.
If you still get broken WordPress images, then, you have one single solution is to contact your hosting provider and show them some examples of your missed images, and any errors screenshots if you have them. That will help to fix the problem in their server.
If you’re hosting on a shared server, then it’s time to think about fully managed and premium hosting for WordPress, I recommend WP Engine. That will not only speed up your blog and serve your images correctly, but it will help rank better in Google for the super-fast loading time. Also, there are other reliable web hosts that are fast for your WordPress blog, and all the other types of CMS and even static sites.
I hope this helped and please share your own method that solved the WordPress image problems when moving websites to a new server.
Keep reading on Trustiko: