WordPress and Content Delivery Network

WordPress has a nice feature of moving Wp-Content folder to a different place. This can be helpful for Content Delivery Network management. Wp-Content directory include all theme files, plugins and any uploads you have.

We can use Content Delivery Network to parallelize the connection in Browser and distribute the loads on server.

Head to wp-config.php file in root of your WordPress installation for playing with CDN settings for WordPress.

Constant WP_CONTENT_DIR is used for telling the customize location of wp-content directory. Tell physical path of wp-content:

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );

Tell the URL for the user accessible contents for client access:

define( 'WP_CONTENT_URL', 'http://o2.satya-weblog.com/blog');

Note: Both address does not have a trailing slash.

There are optional settings especially for plugins.

Constant WP_PLUGIN_DIR is for local path of the directory:

define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );

Tell URL for plugin file:

define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');

PLUGINDIR is for resolving any compatibility issue with plugins:

define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );

Again, no trailing slash in any path.

This is a good feature included from WordPress 2.6 for working with Content Delivery Network. But, when I have tried it, it has not worked for me correctly. Few plugins was not compatible with it. Hyper cache is one example of a plugin which does not work for me. And without caching I cannot use WordPress on simple hosting plan and good traffic blog. I have tried other caching plugin as well but with no success. Another plugin which does not worked was Tabbed Widget. This was showing error related to plugin.php (inside wp-include).

Comments are open for an year period. Please, write here on Facebook page.