WordPress Media Files Show 404 After Moving Domain or Host
After a move, image links often still use the old address or the uploads folder did not come across.
Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Check
- Does
wp-content/uploadsexist on the new server and contain the year and month folders? - Open one image's address. If it points to the old domain, URLs in the database need updating.
- Check file permissions and that the files are not blocked by a rule.
- Check whether images were served through a CDN or offload plugin that no longer has the files.
Fix
- Re-copy the uploads folder.
- Use a safe search-and-replace tool that handles serialized data, after a backup. Never use plain text replace on a SQL dump for WordPress.
- Regenerate thumbnails if sizes are missing. See WordPress Images Look Stretched or Wrong Size: Regenerate Thumbnails.
Full checklist: moving a WordPress site.
Related guides
- Writing Clear Error Reports: Screenshots, URLs and Steps
- WordPress Tag and Date Archives Duplicate Content: Settings
- WordPress Permalinks Change: Redirect Old URLs and Avoid 404s
- Error Establishing a Database Connection in WordPress: Full Checklist
Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.