How and Why to Create a WordPress Multisite?

How and Why to Create a WordPress Multisite?

 

In many cases, installing WordPress and creating a website will do. However, there might be some other cases, when managing multiple websites from a WordPress network will do better.

 

What is WordPress multisite?

 

A WordPress multisite allows for the creation of a network of sites within one single WordPress installation. This option is available in WordPress for the WordPress 3.0+ versions.

Note: WordPress multi-site is free to use.

They are good for managing multiple sites for you as a web designer or site administrator. But when client companies have different hosting providers, it’s better not to use a multisite network.

Depending on how you want to configure the websites in the network, there are 2 types of networks:

 

  • Networks whose sites are created as subdomains (the main domain is www.website.com. site1.website.com will be a separate subsite; site2.website.com will be a different subsite; site1.website.com & site2.website.com might point to www.newsite1.com & www.newsite2.com, through domain mapping).
  • Networks whose sites are created as subdirectories – different paths for the same parent website (www.website.com is the main domain. www.website.com/site1 will be a separate subsite; www.website.com/site2 will be a separate subsite; www.website.com/site1 & www.website.com/site2 might point to www.newsite.com & www.newsite2.com, through domain mapping).

 

In the lines below, we’ll speak about sites that have different paths (case 2).

 

Which are the cases when a multisite is a better option?

 

  1. You are a web designer or an agency that has some clients and wants to manage their websites from one single platform.
  2. You want to create different versions of a website for different linguistic regions, and you’re not that comfortable with a Polylang or WPML installation.
  3. You manage different client accounts, but some clients need more than one website. You can group the websites in several networks, so you better manage the client accounts.
  4. It’s easier to make the updates for the WordPress core files, theme and plugins in one single dashboard, rather than for each individual site.
  5. It’s easier to manage multiple websites with the same theme and the same plugins.
  6. It’s easier to manage multiple websites with the same design scheme.
  7. This option is also good for educational centers, where there are several websites for the different campuses, websites that all belong to a central website.

 

Requirements for creating a multisite network

 

  1. To create a fully functioning network, you have to make sure you have chosen a good web hosting provider.

Here are some of the most popular recommendations for hosting providers, in case you want to create a multisite network:

  • Bluehost – they are one of the leaders, in terms of web hosting for such networks;
  • Siteground – you can have several websites under one account;
  • Hostinger – it has a powerful infrastructure behind it.

 

For full review of web hosting services that are recommended in case of creating multisite networks, check this resource.

 

  1. To create a network of sites, you must be administrator of the WordPress installation you want to use. Otherwise, you cannot operate the necessary changes, as you don’t have access to the files you have to modify.
  2. Regarding the installation you’ll use for a network, please check that WordPress is installed in the root of the web folder (public_html). Otherwise, subdomains will not work from within a subdirectory.

 

Which is the best domain structure for sites in a network?

 

We already mentioned there are 2 types of networks: sites can be created as subdomains (subsite.mainsite.com) or as subdirectories (mainsite.com/subsite). But which one to choose, when you start configuring your network?

 

  • If you use a new, fresh installation of WordPress, then you are free to choose between subdomains or subdirectories. However, if the WordPress installation you plan to use for the network is more than 1-month-old, you are forced to choose the subdomains format. This is because you need to avoid duplicating URLs (the URL of a new subdirectory (e.g. website.com/my-new-site/ might be conflicting with the URL of an already existing page (e.g. website.com/my-new-site)).
  • If you plan to use the network for your personal websites, it’s recommended to use subdirectories, as they are simpler to manage. In case you need the network for client websites, it might be better to use subdomains, as they give a cleaner and more professional look to the client websites URLs.
  • If the hosting provider doesn’t allow you to create subdomains, you’ll need to use subdirectories. That’s why we mentioned earlier in the article you need a good hosting provider that supports creation of a multisite network. See above our recommendations of hosting providers.
  • If you have no such restrictions as the ones listed above, you can choose either to use subdomains or to use subdirectories, depending on your preferences. You might find it more professional to use subdomains, or else it might be simpler to use subdirectories (due to the easy installation of the network formed of sites that have different paths – subdirectories).

 

Now you should have all the necessary data to start creating your WordPress multisite network.

 

How to set up WordPress multisite?

 

You’ll have to make 2 changes to the wp-config.php file, exactly in the order below. Another modification should be done to the .htaccess file.

The first change to the wp-config.php file concerns adding lines of code that allow for enabling the Network Setup menu item.

The second change to the wp-config.php file refers to actually enabling the network.

 

Open the wp-config.php file (find the file, right-click & open with notepad – or another text editor you have installed). It will open with a text editor and looks as you see in the screenshot below:

 

 

Scroll down to find this line:

 

 

You can also use CTRL + F to quickly find this line in your file:

 

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

 

Add the following above the indicated line:

 

/* Multisite */

define( ‘WP_ALLOW_MULTISITE’, true );

 

It should look something like this:

 

 

Save the file and hit refresh.

 

Get accustomed to the new options in the left-hand menu of the WordPress Admin Dashboard.

Go to Tools -> Network Setup to open the dashboard for creating the network of multiple sites. Before you can make any changes here, you need to deactivate all plugins.

Step 8: Create the network of multiple sites. Fill in the blanks with:

  • The network title
  • The email address of the network admin
  • Click “Install”.

 

 

As mentioned, you need to add some extra lines of code to your wp-config.php file, also above the line reading: /* That’s all, stop editing! Happy publishing. */ and after the lines you’ve just added to enable the Network Setup menu item. The lines of code you have to add in the wp-config.php file are specified in the WordPress dashboard for Enabling the Network:

 

 

Save the changes to your wp-config.php file.

Step 8: You also need to make some changes to your .htaccess file.

Open the file (with a text editor) and it will look like this:

 

Replace the lines of code with the ones you copy from the WordPress dashboard for Enabling the Network:

 

 

Save the changes to the .htaccess file.

That’s it. The installation of the network is ready.

Now let’s proceed to creating sites in the network.

Make sure you are logged in to your WordPress. In the left upper part of the screen, a new icon (“My sites”) is now displayed, next to the name of the initial website you created.

 

 

By hovering your mouse over “My sites”, you’ll find the submenu item for “Network Admin”.

Dashboard for the Network Admin

Here’s how the dashboard of the Network Admin is displayed:

 

 

You have an overview of the number of websites you have created and the users managing them.

 

Sites in the Network Admin

In this section, you can create new sites and add them to your network:

 

 

Press the Add New button next to “Sites” to start creating a new site in the network:

 

 

 

Fill in the blanks with:

  • The website address (since our example is for an installation on localhost, the website address will have the form of a subdirectory)
  • The site title (this is the title you attach to the new site)
  • The site language (specify the language for the new site)
  • The email address of the admin for this new site (fill in this area with the email address of the person you want to give admin status for the new website).

 

After having added the site to the network, you can go to the dashboard for that specific site, or you can start editing it.

In the Editing screen, you have options for site attributes, users you can add for managing this website, themes you can choose for the website and site settings.

Below is a screenshot for settings options, in the Editing interface:

 

 

User roles for a network of multiple sites in WordPress

 

The user roles are the same as for a simple site, only you’ll find here the additional Super Admin role.

The WordPress Super Admin is the administrator of the network as a whole. He/she can:

  • add new sites to the network;
  • remove sites from the network;
  • manage other users whom the sites are assigned to;
  • setup the network;
  • make updates for the network;
  • manage network themes;
  • manage plugins at network level.

 

For further info about WordPress user roles, you can read our article on this topic.

 

Installing themes and plugins for sites in a network

 

If you want to install and activate themes for all the sites, you can make changes at the Super Admin level.

Go to My Sites -> Network Admin -> Themes.

Add the theme you want to make available for all sites and then press Network Enable. The theme will be available across the network and it can be activated for all sites.

 

Note: in case of multisites, the usual Admin role has limited capabilities. Therefore, they cannot add a new theme at the site level, without it being previously enabled by the Super Admin.

 

The same goes for plugins. To install and activate plugins for the sites in the network, the Super Admin makes the necessary changes from My Sites -> Network Admin -> Plugins.

Add the needed plugins and click on Network Activate to make them available for all websites.

 

 

Here’s a full list of plugins for multisite networks, you can browse to find a plugin that’s needed for extended functionalities of your network.

 

How to optimize a multisite network?

 

Yes. There’s such a thing as network optimization. It refers to adjustments you can make at the network level, to improve websites performance.

The areas that allow for performance improvements:

  • WordPress updates – it’s highly recommended that the Super Admin of the network should install WordPress updates, whenever they’re available. Thus, security breaches will be avoided, and the network will benefit from WordPress improvements.
  • Themes and plugins updates – it’s advisable to update the themes in use and the plugins active for the websites, to their latest versions. The Super Admin can make these updates for the network.
  • Use a caching plugin for better user experience and management of resources. Breeze is a WordPress cache plugin that works well for multisites. It helps improving sites speed and optimizing resources and it performs database cleanup.
  • Make periodic backups of the network, so in case of any issues, you may revert to the latest stable version.

 

We covered the main points one should consider when planning to start a multisite network. With these in mind, creating the network should be easier. For its management and optimization, the Super Admin should already be in the know and make their best to keep the network updated and fully functioning.

 

All it remains to be done is say…

…Happy multisite management, Super Admins!

 

4 Responses

  1. Dusan Jankov says:

    Great post.
    I have a question. I got a task of creating a multisite with folder base structure but they need structure to be like this mainsite.com and for subsites mainsite.com/locations/state/city. I can’t figure out how to add additional steps .Is this possible ?

    • Veronica Raducan says:

      Hi Dusan.

      This case falls under the 2nd type of network: “Networks whose sites are created as subdirectories – different paths for the same parent website”. The paths can be defined by you and include one or several folders. For exact guidance on doing this, we recommend you contact the hosting provider.

      Please let us know when you solve this task.

      • Dusan Jankov says:

        I solved the task.

        You can specify the path of main site but if you add another step to your sub site then you confuse wordpress because wordpress expects your site path to be one level deep so nested folders will not be found. So you need rewrite rule but i cud not find hook who does it. So you need to use WordPress dropins i added Sunrise.php and a function to search for the blogs with a number of different nested paths, this means that it doesn’t matter how many nested folders we have as this query will check at each level of the path.

        function pu_get_current_site_name( $current_site ) { global $wpdb; $current_site->site_name = wp_cache_get( $current_site->id . ‘:current_site_name’, “site-options” ); if ( !$current_site->site_name ) { $current_site->site_name = $wpdb->get_var( $wpdb->prepare( “SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = ‘site_name'”, $current_site->id ) ); if( $current_site->site_name == null ) $current_site->site_name = ucfirst( $current_site->domain ); wp_cache_set( $current_site->id . ‘:current_site_name’, $current_site->site_name, ‘site-options’); } return $current_site; }

        it works now but cent access dashboard so you need to replace RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L] with RewriteRule ^(.+)?/(wp-.*) /$2 [L] and it works fine

Leave a Reply

Your email address will not be published. Required fields are marked *