Documentation
WordPress multisite support (aka. Network Sites)
A multisite network is a collection of sites that all share the same WordPress installation. They can also share plugins and themes. The individual sites in the network are virtual sites in the sense that they do not have their own directories on your server, although they do have separate directories for media uploads within the shared installation, and they do have separate tables in the database.
The following steps are required in order to enabled multisite support in TurnKey WordPress:
1. Decide whether you want to use sub-domains or sub-directories
Wordpress multisites can either be served from a sub-domain or a sub-directory, for example:
- Sub-domains: site1.example.com, site2.example.com
- Sub-directories: www.example.com/site1, www.example.com/site2
Important: If you decide sub-domains, then SITE would be http://example.com . If you decide sub-directories, then SITE would be http://www.example.com .
Note: Sub-domains require you to be able to update your domains DNS records (see TurnKey Domain management).
2. Update the wordpress configuration
Edit /var/www/wordpress/wp-config.php
Delete the following:
define('WP_SITEURL', 'http://'.\$_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://'.\$_SERVER['HTTP_HOST']);
And in its place, add (replace SITE with what you decided in step 1):
define('WP_SITEURL', 'SITE');
define('WP_HOME', 'SITE');
define('WP_ALLOW_MULTISITE', true);
Update the database
mysql --defaults-extra-file=/etc/mysql/debian.cnf <<EOF USE wordpress; UPDATE wp_options SET option_value='SITE' WHERE option_name='home'; UPDATE wp_options SET option_value='SITE' WHERE option_name='siteurl'; EOF