Allow multiple sites on a common code-base
|Reported by:||ergonlogic||Owned by:|
Description (last modified by SergeyBiryukov)
It would be nice to be able to run multiple independent WordPress sites on a common code-base. I'm not talking about the multisite feature, but rather what's documented here: http://codex.wordpress.org/Installing_Multiple_Blogs.
Since we can already keep our wp-config.php separate from the WordPress code-base, this can be accomplished with symlinks, and a simple patch (attached). Basically, the file structure could look something like:
/var/www/wordpress-3.5 /var/www/example.com /var/www/example.com/wp-config.php /var/www/example.com/wordpress -> /var/www/wordpress-3.5/ /var/www/example.org /var/www/example.org/wp-config.php /var/www/example.org/wordpress -> /var/www/wordpress-3.5/
The vhosts would then look like this:
<VirtualHost *:80> ServerName example.com DocumentRoot /var/www/example.com/wordpress </VirtualHost>
<VirtualHost *:80> ServerName example.org DocumentRoot /var/www/example.org/wordpress </VirtualHost>
The patch to wp-load.php simply changes settings ABSPATH from this:
define( 'ABSPATH', dirname(__FILE__) . '/' );
define( 'ABSPATH', $_SERVER[ 'DOCUMENT_ROOT' ] . '/');
From my (admittedly limited) testing, this appears to work just fine. With a couple small tweaks along the same lines to wp-cli (https://github.com/wp-cli/wp-cli/issues/478) it appears to work just fine from the command line too. For a bit of background on where I'm coming from with this, see: https://drupal.org/node/1044692#comment-7473232.
I'm relatively new to WordPress, so forgive me if this (or something like it) has already been suggested and shot down for some technical reason. I haven't seen anything that looks related in searching through the issue queue.
Change History (5)
comment:1 @SergeyBiryukov — 2 years ago
- Description modified (diff)
- Version changed from trunk to 3.5