WordPress multi blog hosting
Sep 27th, 2009 by morpheus
If you manage multiple wordpress based blogs, you know it can be quite a chore.
Keeping the installations up-to-date is cumbersome. Add to that the time and effort spent keeping all the plugins up-to-date and you’re spending quite a lot of time there already.
Thankfully, there are several options that, if you find them suitable, can make your job easier.
I’m going to talk about the one that worked the best for me – the one using symbolic links.
I had on my hands multiple blogs each with different owner/author and different databases.
All I had to do was –
- put all standard wordpress files into a directory above the level that the individual blogs were located – these files will now be shared by all blogs (make sure the path’s accessible to php for includes)
- remove all standard files/folders (except wp-config.php) from each of the individual blog’s docroot
- in each individual blog’s doc root, create symlinks pointing to all standard files & folders within the shared wordpress directory.
- add to the each individual wp-config.php the following line –
define('ABSPATH', dirname(__FILE__) . '/');
- in the shared wp-load.php, change –
define( 'ABSPATH', dirname(__FILE__) . '/' );
to read –
define( 'ABSPATH', $_SERVER["DOCUMENT_ROOT"] . '/');
the directory structure of each individual blog’s docroot looks like so –
If you wish to share a few plugins and themes, but keep a few different plugins/themes on different blogs, this can be done in the same way.
In each blog’s doc root, don’t create a symlink to the whole shared wp-content. Rather symlink the individual plugin or themes folders instead.
like so –
It may be a good idea to have all plugins/themes inside the shared wp-content instead of in individual blog’s wp-content, and symlink them back into individual blogs as required. This makes updating the plugins etc. easier. (I share all-in-one-seo-pack and google-sitemap-generator across multiple blogs)
Now to update wordpress (for all the blogs), just extract the new wordpress files overwriting the shared wordpress directory!
The shared plugins can be updated across the board in the same way !
This blog is now running with this hack, leave a comment if you notice something not working correctly. (I tested and found comments to be working fine 😉 )
p.s. – The shared wordpress files are owned by root and are not writable by individual blog, and security is maintained by suexec’d php.
This might mean that plugin installation/update might now work from within the wp-admin area’s UI. You’ll have to do it from command line.