Change WordPress wp-content Directory Location
Published September 18th, 2011 | categories include: CMS, Informational, Server, server-side, Wordpress |
Share on Twitter
Changing your default WordPress wp-content, themes and plugins directory has several main advantages.
- security by obscurity – script kiddies will attempt to probe your plugins or themes directory for known bugs and attempt to exploit them. moving the contents of your wp-content folder helps to secure your contents by obscurity.
- easier upgrades for multiple hosted sites – if you host multiple WordPress sites, you know that theme and plugin upgrades can be a pain. by using a single location for your wp-content folder components, you eliminate the need to update multiple sites.
According the the WordPress page here, you will begin by editing your wp-config.php and entering the location of your wp-content folder.
define( ‘WP_CONTENT_URL’, ‘http://sub.sitename’);
define( ‘WP_CONTENT_DIR’, ‘/server/path’);
In the example above, the wp-content folder, which includes index.php, themes and plugins will be located at http://sub.sitename/themes and so on. It is important that both declarations be placed in the wp-config.php. Otherwise, I found out that only using the WP_CONTENT_URL breaks the whole intent of changing the path to begin with. You can find a host of WordPress config.php declarations here.
Next, go ahead and delete the wp-content folder if you have not already moved it to the new home.
As mentioned above, changing the wp-content directory location has a few main benefits for me. However, these improvements do nothing if you haven’t set the folder and file permissions appropriately. Please make sure that you assign the appropriate group, owner and read, write and execute (e.g. chmod) permissions or none of the work that you just completed means a damn.
Previous Post: « Varnish Administration Console Adds Ban ManagementDo you have something to say? Send me a message on my Google Plus profile.
Next Post: WeatherSpark Provides a Fresh Look into the Weather »