Introduction to WordPress Multisite Installation

Introduction to WordPress Multisite Installation pixelwork

Introduction to WordPress Multisite Installation

WordPress Multisite Installation

 

WordPress multisites are a collection of independent websites that share the same WordPress installation. Network sites are virtual sites, meaning they do not have their own directory on the server, although they do have separate directories for file uploads and separate tables in the database.

In this post I will give you an introduction to WordPress Multisite. This will be a basic user guide aimed at pointing out the pros and cons of Multisite VS single site installations, and to show you how to convert a WordPress site into a Multisite network.

First of all, I will try to give you an idea of ​​the many reasons for installing a network, and conversely many factors that could prevent you from installing a WordPress Multisite. Below I will provide an overview of the types of networks available, describing the main features of each type and the system requirements that might force you to choose one type over another. Finally, we're going to dive deeper into the installation process, and I'm going to show how simple it is to migrate a single WordPress installation to a network of sites.

Note: Chances are, after reading this post, you'll switch from a single WordPress installation to a Multisite installation.

 

Pros and cons of WordPress Multisites

You may have good reasons to migrate from a single site to a Multisite installation. Firstly, a Multisite allows you to create a network of independent websites, and you could give site users the ability to join the network by creating their own blogs, just like WordPress.com users.

You might think that this service would not be in your business, and yet you may decide to switch to WordPress Multisite to save time and work. With a Multisite you can set up a number (even a large number) of websites and manage them from a single WordPress installation. On a Multisite, you will need to update the core, themes and plugins only once, because all sites on the network share the same installation.

A Multisite can save you a lot of time and definitely increase the efficiency of your work.

Finally, if you need to present living examples of your work, you can switch to Multisite and activate a sub-site for any project. This practice will help you improve your professional image, provide high-quality service to your clients, and help you keep your work well organized.

In reality, switching to Multisite is not always possible. Our first and most important consideration is related to security: if your website is hacked, the entire network will be compromised. If you decide to switch to Multisite, consider the opportunity to invest a lot of time and resources into improving the security of your installation.

Multisite mode is not an option when you need to share information between subsites. If you want to create a network of interconnected websites that share users or data, you may consider installing a single WordPress website and dividing it into sections rather than a collection of separate sub-sites.

Additionally, there are many other reasons that could prevent you from installing a Multisite. Some of these reasons depend on your client's requests and needs, others are related to system requirements and server configuration. Sometimes technical limitations can be overcome with the help of your hosting provider, but sometimes you should definitely turn to a more advanced hosting service.

 

Subdomains and subfolders

Depending on how you handle URLs, Multisites provides two different types of networking:

  • Domain-based networks (Subdomains)
  • Route-based networks (subfolders)

A domain-based network uses URLs such as http://mysite.network.com. These domain names can be configured correctly in several ways. The Codex suggests one of the following:

Wildcard subdomain setup

Virtual Host Configuration

Creating addon domains or subdomains in the web hosting control panel

 

A route-based network uses URLs such as http://network.com/mysite. This type of network requires Pretty Permalinks enabled to function properly. Regardless of the type of network you are installing, you can assign external domains to existing subsites. As of WordPress 4.5, domain mapping is a core feature in WordPress Multisite, and we no longer need a third-party plugin like WordPress MU.

Once you've decided what type of Multisite to install, you need to prepare your existing WordPress installation to convert it to a network:

  • Upgrade your existing installation and run a full backup of your files and database.
  • Check if Permalinks are working correctly.
  • Deactivate all active plugins. You will reactivate them later.
  • If you plan to run WordPress from your own directory, configure your installation before activating Multisite.

Finally, we can begin the installation process.

 

Network installation

Before we can install the Multisite network, we have to enable the network configuration functionality. To achieve this task, we only need to define the constant WP_ALLOW_MULTISITE in wp-config.php:

/* Multisite */ Define ('WP_ALLOW_MULTISITE', true);

This code should be added above the following commented line:

/ * That's all, stop editing! Happy blogging. * /

Update the file wp-config.php and refresh the page: the Network Settings menu item will appear in the Tools menu. If WordPress reminds you to deactivate all active plugins, deactivate it and return to the network settings page.

 

Now we have to choose the type of network we are going to install from the options based on the domain and the route.

 

To avoid conflicts between the URLs of the pages on the original site and the URLs of new sites on the Network, creating a domain-based network will not be allowed at this time on installations that are more than a month old. Anyway, as I'll explain in a moment, you can manually edit the wp-config.php file later to switch to a subdomain network.

This page displays the server address and two form fields whose values ​​define the network title and network administration email.

 

Next, make a backup of the existing wp-config.php file and run network setup.

On the next page, WordPress provides detailed instructions on the changes to make to the configuration files. In the wp-config.php file define the following constants:

define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', true ); define( 'DOMAIN_CURRENT_SITE', 'carlo.kinsta.com' ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 );

Set SUBDOMAIN_INSTALL to true if you are installing domain-based networking, false if you are installing route-based networking. You can change the network type later, although WordPress warns that this will not be possible.

Note: In order to avoid conflicts between an existing post or page slug and a website path, WordPress will not allow you to install path-based networking on installations older than one month. Anyway, you can install a domain-based network and then switch to a route-based network later by changing the SUBDOMAIN_INSTALL value in wp-config.php.

Apache users should replace existing .htaccess directives. The new file will be a little different between sub-folder and sub-domain installations. The following example shows the .htaccess file for a subfolder installation:

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]

On a sub-domain installation, the .htaccess file will change as follows:

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)$ wp/$1 [L] RewriteRule . index.php [L]

When you are done with wp-config.php and .htaccess, log out and log in again. The My Sites menu should appear on the left side of the WordPress toolbar.

 

The network is up and running and we can now enable the plugins we previously disabled.

 

Conclusions and further readings

From now on you will be the Super Admin of the Network and the administrator of the original site.

In the Network panel, you will be able to create, configure and delete subsites, install themes and plugins, manage network users, run updates and configure network settings.

 

In the sub-site dashboards you can perform any administration task available to a WordPress admin user with some differences when it comes to themes and plugins, which can be installed, updated and deleted only in the network administration area.

 

Sometimes converting a single site to a Multisite is not as simple as it is for websites hosted by some hosting companies. If you need to know more about DNS configuration, system requirements, and other technical details, see the following resources:

Do you have any WordPress Multisite installation? Share with us your experience in the comments.