// wordpress & cpanel how-tos
WordPress images not showing up after migration: fix it now
Moving WordPress is easy when you follow a few rules. But sometimes your images stop showing after the move, and you need to find out why before you can fix it.
Why images break after a move
There are two main cases. If you moved the site to a new server but kept the same domain name, the image files are missing or damaged on the new server, or their permissions are wrong. If you changed the domain name or moved WordPress to another folder, your posts still point to the old address, and you need to replace the old URLs in the database.
Read the case that matches yours, or follow them one by one. If the problem is uploading new images rather than showing old ones, see why you can't upload images in WordPress.
Case 1: same domain, new server
Here the problem is usually the uploads folder itself, or one month inside it. Right-click a broken image and open it in a new tab to see its address, for example yourwebsite.com/wp-content/uploads/2014/05/this-is-an-image.png. The month is "05" in the 2014 folder, so that's the folder to check. A broken link checker plugin can list all the broken image URLs for you.
Log in to cPanel, open File Manager and go to wp-content/uploads, then the year and month. If the folder is empty or the files are missing, re-upload them. If the files are there, the permissions are probably wrong.
Re-upload the missing files
During a migration, a short connection problem can break part of a folder, and images are the biggest part of most sites. You need a working copy of the uploads folder, from a backup or from your old server.
Compress the old uploads folder into a zip file, upload it to wp-content on the new server and extract it there, replacing the broken folder (I show how in how to download and upload files in cPanel). If the whole folder is too big, upload the year or month folders one by one, keeping exactly the same names and structure as on the old server.
Then clear your caching plugin and your browser cache, or open the site in another browser, and check your posts again.
Fix the file permissions
Some servers use strict settings by default. Select the uploads folders in File Manager, click Permissions and set folders to 755 and image files to 644. In 2014 I suggested 777 if 755 didn't work, but that's a security risk, so don't use it. If the images still don't load with the right permissions, ask your host to fix the file ownership, which often goes wrong after a migration.
Case 2: new domain or new folder
This is the case when you change the site's address completely (from www.oldblog.com to www.newblog.com), or move WordPress to another folder (from www.yourblog.com/wp to www.yourblog.com, or the reverse). Your images still point to the old URL, which is normal: WordPress stores full image addresses inside your posts. You need to replace the old URL with the new one everywhere in the database.
Back up your database first, because these methods change it directly, and check that you type the new address exactly.
Option A: a search and replace plugin
Install a plugin like Better Search Replace, open it under Tools, enter the old address in "Search for" and the new one in "Replace with", and select all tables. Run it once as a dry run to see how many changes it finds, then run it for real. A good plugin handles "serialized" data, the settings that widgets and themes store, which a simple SQL query can break.
Option B: WP-CLI or an SQL query
If your host offers SSH, WP-CLI does the same job in one command and also handles serialized data:
wp search-replace 'https://www.oldblog.com' 'https://www.newblog.com' --dry-runRemove --dry-run when the results look right. For advanced users, you can also run an SQL query in phpMyAdmin. It only updates post content, which is where most broken images are:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'www.oldblog.com/', 'www.newblog.com/');Change wp_ if your tables use another prefix.
Still broken?
If the images are still broken after all of this, contact your hosting provider with a few example URLs and screenshots of any errors. That helps them find a problem in their server configuration. If you keep hitting problems like this on a cheap shared server, compare hosts in my list of the best WordPress hosting for blogs.
FAQ
Why are my WordPress images not showing after migration?
Either the image files didn't copy correctly to the new server (or have wrong permissions), or you changed the domain and your posts still point to the old URL. Re-upload the uploads folder, set folders to 755 and files to 644, or replace the old URLs in the database.
How do I replace old URLs after moving WordPress to a new domain?
Back up the database, then use a plugin like Better Search Replace or the WP-CLI search-replace command to change the old address to the new one in all tables. Both handle serialized data safely.
Can I fix broken images with an SQL query?
Yes, an UPDATE query on wp_posts with REPLACE fixes images inside post content. It doesn't safely handle serialized data in widgets and settings, so a plugin or WP-CLI is safer for a full domain change.
SOURCES
Prices and limits change. We note the date we checked each one; confirm on the provider's site before you buy.