Change WordPress Uploads to Subdomain

Auto upload your media files to a subdomain on the same server AND change default path.

By β™Ÿ Vondelphia.com β€” Updated Nov 14, 2020

Let’s migrate your current WordPress media uploads files to another domain. A specific sub-domain will make your images load faster (if configured properly) and be shorter file names too.

Default WordPress Media Settings

  • https://von.enterprises/help/wp-content/uploads (upload path)
  • http://vondelphia.com/files/logo.png (file name)

New WordPress Media Settings

  • https://files.von.enterprises (upload path)
  • http://vondelphia.com/files/logo.png (file name)

Let’s remove and replace help/files/ from all uploaded media with files and of course, migrate / transfer files to the new subdomain. It’s important that all new uploaded images are automatically moved to the subdomain too!

  1. Install and Activate two plugins
  2. Create a backup of your database by clicking “Create SQL File” in the Search & Replace Plugin Admin (under Tools menu)
  3. Search & Replace your default upload domain to your new domain path with Dry Run and confirm that it’s to your likings, than uncheck Dry Run and click Save changes to Database and click Do Search & Replace.
    • in our example, we wanted to change help/wp-content/uploads to files.
  4. After you deactivate Search & Replace, navigate to WP Original Media Path under Settings and check Expert mode.
  5. In the Full URL path to files field, just specify the url for your upload folder and click Save Changes.
  6. Goto your Media Library and test upload a file, everything will work perfectly (even Thumbnail generated images work during upload). Using your sFTP Client, visit your subdomain directory and you’ll notice files are being uploaded accordingly. IF NOT, just check your file permissions.

Change WordPress Uploads to Subdomain
After you create a backup of your database, do a search & replace Dry Run
Change WordPress Uploads to Subdomain
After lots of testing, if I didn’t check Expert Mode the files would not move to subdomain.

Sources

  • Upload images to remote server
  • Wordpress: Upload images to remote server
  • upload images to subdomain

Was this helpful?

Yes! πŸŽ‰ No! πŸ˜‘

Not quite what you're looking for? Get Help

Leave a Comment

Item added to cart.
0 items - $0