One of the features added for Wordpress 2.6 and above is the ability to relocate and rename the “wp-content” folder that holds the themes, plugins and (by default) uploaded files used by your blog.
The rationale behind the addition of this feature was to separate the user generated or otherwise customised content of a blog from the core Wordpress system that drives it. This separation greatly simplifies a couple of common Wordpress administration headaches,namely updating Wordpress to a new version for those of us who don’t or can’t use the built in update feature and driving multiple blogs from one copy of the Wordpress system files.
Moving the wp-content directory is actually quite straightforward and is achieved by adding two define() directives to your Wordpress configuration file, “wp-config.php”.
/** set location of content dir */ define('WP_CONTENT_DIR', '/path/to/wp-content'); define('WP_CONTENT_URL', '/url/to/wp-content');
The first of these, WP_CONTENT_DIR, is used to specify the actual filesystem path of the content directory, which need not even be named “wp-content”. Note that, whatever path is used, it must be accessible by the web server process as CSS, images and other files required by client browsers will be served from there. You may wish to consider using the $_SERVER['DOCUMENT_ROOT'] global variable to construct a path relative to the document root, as shown :
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content');
The WP_CONTENT_URL definition specifies the base URL from which resources in the content directory may be accessed. This is required as, in many installations, the filesystem and URL namespaces have no direct correlation and are instead mapped in the web server configuration. Taking the example above, where we moved wp-content into the top level of the server document root, WP_CONTENT_URL would be defined as follows:
define('WP_CONTENT_URL', '/wp-content');
If you wish to use the new wp-content folder to store media files you upload for use in your blog posts, you will also need to enter your new wp-content path into the Settings / Miscellaneous Settings / Uploading Files configuration page within the Wordpress administration screens. The screenshot below is taken from Wordpress 2.7.1, other versions of the software may be different.
Unfortunately, these relatively simple changes are not the end of the story. Many popular Wordpress plugins and themes do not (yet?) take account of the fact that wp-content might not now be where it always has been before, and so they fail to work if the directory is relocated. However, we can restore some level of compatibility by using the Apache mod_rewrite functionality to rewrite requests referencing the old wp-content location to reference the new location instead.
The example below shows how to use mod_rewrite to alter requests to /wordpress/wp-content to reference /wordpress-content. To illustrate, a request to load /wordpress/wp-content/themes/mytheme/style.css would be altered to load /wordpress-content/themes/mytheme/style.css. Add the lines shown to the start of the .htaccess file in your Wordpress installation, before the # BEGIN WordPress line, and restart or reload Apache to pick up the changes.
# rewrite wp-content requests to new location
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_URI} ^/wordpress/wp-content(/*)
RewriteRule ^wp-content/(.*)$ /wordpress-content/$1 [L]
# BEGIN WordPress
...
# END WordPressNote that this is only a workaround and isn’t guaranteed to work for all plugins and themes. In particular, this fix cannot help if a plugin or theme uses hardcoded wp-content paths to load PHP code files. In that instance the only thing to do is contact the author of the offending code and pester them for an update!
Moving wp-content isn’t for everyone and I imagine that for a lot of users it won’t be necessary or even helpful. It’s still a new feature (though arguably one that should have been there from the beginning) and for those, like me, that implement it there may be some pain to be endured before common themes and plugins are updated to take account of it. But given how it simplifies the administration of my Wordpress installations, I find it’s worth the trouble.
Have you tried moving your Wordpress content folder? Did you run into any trouble? Share your experience in the comments section below.



I installed a WP on the root level of a server. Now the client wants me to make a splash page at SITENAME.com, which would be an HTML page INDEX.html, of course. If I move all the files via ftp into a directory like /blog I know it will confuse the config file or something. What code do I need to put where to account for this move? Really appreciate any time you can give me, I’m stuck on this job on a Sunday and want to finish! Thanks.