Knowledgebase
How to enable and install a multisite network in WordPress
With a single WordPress installation you can have more than one blog/site. This can be done with the multisite functionality. To do this you need to perform the following:
- If you are not going to use a new installation and you want to make sure that you don't lose anything, back up the WordPress files and the database used by the application.
- Log into the admin panel and disable all plugins.
- Edit the wp-config.php file of the WordPress installation and add the following code in it: define('WP_ALLOW_MULTISITE', true);
- Refresh the admin panel of your site and go to Tools menu>Network Setup sub-menu.
- From the respective option on the page that opens select whether you want the sites that you add to the multisite network to be subdirectories of the main site (e.g. yourdomain.com/site1) or subdomains (site1.yourdomain.com). To be able to select subdomains the WordPress installation has to be in the root web-accessible folder (e.g. public_html) on your hosting account. To be able to use subdomains your hosting account should also be configured to use wildcard subdomains. HostKnox customers can use wildcard subdomains.
From the respective options on the same page you can also change the title of the network and the admin address of the super admin (the admin that has access to the network admin and to the admin panels of any site in the network).
Then click on the Install button.- On the following page you'll see the code that you have to add in the wp-config.php file and in the .htaccess file of your WordPress installation.
- The code that you need to add to the wp-config.php file if you're going to use subdomains is:
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', 'yourdomain.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);You only have to replace yourdomain.com with your real domain name.
For a multisite with subdirectories the code is almost the same:
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'yourdomain.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);Here you also have to replace yourdomain.com with your actual domain name. If your WordPress is not installed directly in the public_html directory on your account but in a subfolder (e.g. public_html/folder/applications), then you need to put the path in the line define('PATH_CURRENT_SITE', '/');. For example: define('PATH_CURRENT_SITE', '/folder/applications');.
- The rewrite directives that you have to put in the .htaccess file of your WordPress installation if you're going to use subdomains are:
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^wp-admin$ wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L]If you set up your multisite to use subdirectories the directives that you have to put in the .htaccess file of your WordPress installation are:
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]In case your WordPress is not installed in the root web-accessible folder (public_html) on your hosting account but in a subfolder, then you need to put that the path to the subfolder in the RewriteBase directive (e.g. RewriteBase /folder/applications).
- After you put the necessary code in the wp-config.php file and in the .htaccess file log in to the admin panel of your WordPress again. Now that admin panel is actually the network admin from which you can add new sites to the multisite network, you can delete them, you can access the admin panel of each particular site in the network and you can manage all the other network settings. To add a new site go to the My Sites drop-down menu in the top left corner and then to Network Admin>Sites.
For some more details and screenshots check out the tutorial on how to set up a multisite in WordPress.
The following tutorials may also help you in configuring and managing your WordPress multisite: