Moving Out Of WordPress Media Uploads Directory (For Easier Management & Backups)

By default WordPress stores all uploaded media library files in your website ‘s root -> wp -content -> uploads folder. Moving this (uploads) directory to some other location would make file backups and management much easier. 

It is always good to keep media uploads folder outside the WordPress installation folder, on a sub-directory or sub-domain. This not only saves your data from hacker attacks but the corresponding data download on client’s browsers improves your website loading time.

So how to do this? First login to your website’s file manage and create a new sub-domain or sub-directory.

Your second step is to open your wp-config.php file (located in your website’s root directory) and use the following lines:

define( 'WP_CONTENT_URL', 'http://sub.yourdomain.com/media-content' );
define( 'WP_CONTENT_DIR', $_SERVER['HOME'] . '/sub.yourdomain.com/media-content' );

The given code changes the location of your website’s wp-content folder.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.