Move WordPress content Folder to Subdomain

WordPress is an awesome blogging portal. As your WordPress site grows the content like themes, uploads and plugins also grow. At some point of time the the size of wp-content directory grows to an unmanageable level. Now taking backups of your WordPress installation or moving the WordPress installation to some other server becomes clumsy. To avoid such situations WordPress has come up with an excellent solution. Since Version 2.6, you can move the wp-content directory, which holds your themes, plugins, and uploads, outside of the WordPress application directory.

We recommend that the wp-content directory should be moved to a new domain or sub-domain.
Benefits of moving wp-content to other (sub)domain.
1. Easy and hassle free data transfer
2. Faster loading of static resources like images, css and javascript files as the browser will allow paraller loading of resources from other (sub)domain.

To do this simply follow the below steps:

Here we assume that our directory structure is something like:
-/home/public_html/wordpress/

1. Create a new directory (lets say ‘files’) like /home/public_html/wordpress/files/. You can chose any other location.

2. Create a new subdomain (lets say files.example.com) in you hosting account and point it to the newly created ‘files’ directory.

3. Now copy the /home/public_html/wordpress/wp-content/ drectory to /home/public_html/wordpress/files/wp-content/

4. Open your wp-config.php and add following lines to it:

define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/files/wp-content' );
define( 'WP_CONTENT_URL', 'http://files.example.com/wp-content' );

And you are done. Now refresh your website and you shall see all the content being loaded from the new (sub)domain.

Written by Arvind Bhardwaj

Arvind is a Magento and WordPress expert with more than 6 years of industry wide experience.

Website: http://www.webspeaks.in/

7 thoughts on “Move WordPress content Folder to Subdomain

  1. Thanks for this. Much easier than actually moving the files to the sub-domain and having to make changes to the database.

  2. thanks a lot for your great content
    but i have a problem – my site not loaded after adding this code to wp-config.php
    i create sub domain and move wp-content to sub domain folder
    what i must do ?
    need do anything more?

Comments are closed.