2.13.1.16. Multisite setup in WordPress

A multisite can be set up both on a pure WordPress site and on an already working site. In the second case, before setting up, you must create a backup copy of the site and base. In this article, the installation will be performed on a site named site.com.

  1. At the beginning config file site wp-config.php add the line:
    define('WP_ALLOW_MULTISITE', 'true');
  2. Openup Adminpanel site.
  3. Go to section "Tools → Network setup" and choose the appropriate view URL.
    Address (URL) of a network site can be of three types:
    • Subdomain - site1.site.com, site2.site.com (used by default).
    • Subdirectory - site.com/site1, site.com/site2.
    • Separate domain - site.com, site2.com.
  4. Clickon "Install":
  5. At the beginning config file site wp-config.php in the catalog /home/name_account/site.com/www add the lines that WordPress will show. In this example, these are:
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'example.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
  6. In file .htaccess in the catalog /home/name_account/site.com/www replace all rules with the following:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    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]
    RewriteRule . index.php [L]

After completing these steps, your network will be activated and configured. You will need to log in to the site admin panel again to obtain super-administrator rights. There you will find a new option in the admin navigation menu called "My sites"... Network management must be carried out through this section.

  1. In the admin panel of the site, open the section "My sites → Network management → Sites → Add new":
  2. Fill in all the fields and click "Add site" (you can find your sites in the section "Sites → All sites"):

Only the super network administrator can install themes and plugins. Installation is done through the section "Network management"... In addition to installation, you will also need to activate a plugin or theme for the web:

After this action, you can log into the admin panel of the created sites and use the themes and plugins that you have enabled for the network there.

  1. To change the mode from subdomains to subdirectories, change in the file wp-config.php line:
    define('SUBDOMAIN_INSTALL', true); 

    On this one:

    define('SUBDOMAIN_INSTALL', false);
  2. You will also need to update the rules in the file in .htaccess... To section "Network setup" you can already get through "My sites → Network management → Settings" or by a direct link of the form http://site.com/wp-admin/network/setup.php:

In versions of Wordpress from 4.5.x, it became possible to organize a multisite on different domains without the need to install additional plugins. You need to set up multisite for subdomains or subdirectories.

  1. Add the required domains to aliases site.
  2. In the admin panel of the site in the section "My sites → Network management → Sites → Add new" add a site with any name:
  3. In chapter "Sites → All sites" click "Change" near the created site:
  4. Change URL site in the tab "Information" to one of those domains that you added to the aliases and save the settings:
  5. Also change URL in the tab "Settings":
Content