🚀 Your daily business tech & AI briefing — Subscribe free →

WordPress image uploads broken after migration? Here’s why

WordPress image uploads not working after migration? Fix file permissions, paths, and database issues. Step-by-step troubleshooting guide.

Zain A
Share this article

Introduction

Context and impact of image upload failures after migration

Image uploads fail after server migration because file permissions, directory paths, or database references get tangled in the move — and WordPress doesn’t always tell you which one. This fix walks you through the three most common causes and how to spot which one is actually breaking your site.

What this guide covers

Expect a practical workflow with concrete steps to prevent recurrence. You will learn how to:

  • Map broken URLs to their correct paths using server logs and sitemap comparisons
  • Repair media references in the database and media library with targeted queries
  • Check filesystem ownership and permissions, then apply secure, web-friendly modes
  • Test URL replacements end to end and verify CDN caching behavior
WordPress image uploads broken after migration? Here’s why

1. Rebuild Media Paths with the WP-Config Pinpoint

Identify broken image URLs

Audit image links by checking which URLs fail to load in the new environment. Look for patterns like old domains, mismatched folders, or protocol shifts (http to https). Keep a concise log with examples to guide fixes.

  • Scan media URLs in the database for the old site domain
  • Check attachment GUIDs for migration anomalies
  • Note CDN links that no longer resolve locally

Update wp-config.php for site URL and home URL

Set WordPress constants to the new hosting setup. Correct values ensure media and references resolve to the right paths.

  • Define WP_HOME and WP_SITEURL with the new site URL
  • Avoid hard coded paths pointing to the old server
  • Save changes and clear opcode caches to apply updates

2. Regenerate Thumbnails with Regenerate Thumbnails Plugin

Installing and configuring the plugin

Install Regenerate Thumbnails from your WordPress dashboard, then activate. Open the settings and confirm it targets every registered image size your theme and plugins define, including custom sizes.

  • Verify the list of registered sizes and add any missing custom sizes used by your site
  • Use default options to regenerate all thumbnails in one pass
  • Disable auto-regeneration on upload to prevent conflicts during the batch run

Batch regeneration workflow and verification

Run a full batch regeneration to rebuild all image derivatives. After completion, test a representative mix of pages and posts to ensure visuals render as expected.

  • Regenerate all thumbnails in a single run for consistency across pages
  • Clear caching layers, including CDN, to ensure updated thumbnails are served
  • Spot-check featured images, gallery blocks, and product images for proper sizing and alignment

3. Correct the .htaccess and Redirect Rules for Media

Check .htaccess for media rewrite rules

Open the server’s .htaccess and confirm media paths remain accessible after migration. Examine rules that affect uploads, images, or the uploads directory. Misplaced redirects can trigger 404s or cached errors even when files exist.

  • Ensure no conflicting rewrite rules alter /wp-content/uploads paths
  • Verify a clear base rule set that permits direct access to uploaded files
  • Check for server-level redirects pointing to the old domain or protocol

Implement proper redirects to uploaded images

Set redirects that keep media requests aligned with their on-disk locations. This prevents broken pages that rely on assets after the move.

  • Define precise redirects for the uploads directory rather than broad image paths
  • Prefer 301 redirects to preserve SEO signals and link equity
  • Test a representative batch: hero images, gallery thumbnails, product photos
WordPress image uploads broken after migration? Here’s why

4. Verify Uploads Directory Permissions and Ownership

After migration, incorrect permissions or ownership can prevent WordPress from reading or writing files in the uploads directory. This blocks new uploads and can cause broken image references even when existing files seem intact.

Check wp-content/uploads permissions

Ensure the uploads directory is writable by the web server. Use permission settings that balance accessibility and security.

  • Directory: 755 on most systems
  • Files: 644 by default for uploaded assets
  • Verify recursive permissions for subdirectories and existing files

If permissions differ, adjust them carefully and recheck upload operations. Misaligned permissions are a common cause of silent upload failures.

Adjust file ownership and prevent future errors

Ownership should reflect the web server user to avoid permission errors during file write operations. Align ownership with your hosting environment to prevent recurring issues.

  • Set ownership to the web server user (for example, www-data or apache)
  • Rebuild ownership for the entire uploads tree to cover new and existing files
  • Ensure plugins and themes can write to their respective media paths when needed

Document any ownership changes for future migrations. Verified ownership and correct permissions reduce the risk of silent image failures and ensure new uploads load reliably.

Share this article

Stay in the Loop

Weekly tech insights, AI news and tools — straight to your inbox.

Newsletter Form (#4)

Contents