In this tutorial, I’ll explain what a WordPress multi-site is, why set it up and most importantly how!

What is a multi-site?

Most of you might be familiar with “classic” WordPress, or “single” WordPress as it is also called. It is an installation of our CMS that will be used to proudly power a website.

By enabling the “Multi-site” feature, your “classic” WordPress with a single installation will be able to power as many websites as your server can handle!

The best example in this area is wordpress. com, the website platform created and managed by Automaticc. This commercial service that powers several million websites is in fact a single installation of WordPress!

Since WordPress 3.0, multi-site functionality is fully integrated into WordPress.

When to use a site network?

It can be interesting to create a site network when you are going to have several sites to host… you will then manage only one installation sharing themes and extensions. You will save time in maintenance since you will update for example only one WordPress core, one extension or theme version.

Different uses

Multi-site is also sometimes used to create a multilingual site. You can assign a language to each site and write different content for each site.

The networked sites can also be used to create a site by site company, a holding and its subsidiaries for example.

How do I set up a multi-site with WordPress?

There are 2 ways to create a site network:

  • In sub-domain: your url will be in the form site1.example.com, site2.example.com
  • In sub-folder: your url will be like exmple.com/site1, example.com/site2

If you install your network on a new installation, you will have the choice between these 2 structures. If you are converting an existing WordPress installation, you will have no choice but to choose the sub-folder installation.

Note that there is nothing you can’t do with one installation that you can do with the other!

Creating the network

First of all, for this example, I’m going to start with a local installation of WordPress.

Of course, it is highly recommended to make a full backup (files + database) at this level.

If you follow the WordPress developer’s bible, I named the Codex, you will understand that you have to create a PHP constant in the WordPress configuration file located at the root of your installation.

/* Multisite */
define('WP_ALLOW_MULTISITE', true);
/* That's all, don't touch the following! */

The purpose of this constant is to tell WordPress that we allow it to create a Multisite:

WordPress

Let’s click on the new entry in the “Tools” menu named “Network Creation”. You will get this page:

Capture d'écran

It is at this step that you can choose the structure of your URLs. Either in subdomain or in subfolder. If you want to choose the URL in sub-domain, you will have to create a wildcard entry in your DNS records.
In my example above, to get site1.tuto-multisite.local you will have to create a wildcard in DNS with the asterisk character (*) : *.tuto-multisite.local and point it to the folder containing your WordPress installation.

Click on “Install”

Capture d'écran

Ok so there I have an error message because I requested a subdomain installation of my WordPress network and I didn’t create a wildcard domain as requested. This is because on my local installation… it’s not easy!
WordPress tried to create the random sub-domain 14b292.tuto-multisite.local on the fly and failed. If you are installing locally, you can create the domain by editing your “Hosts” file.

The installation is almost finished, you just have to copy the 2 blocks of code in the .htaccess and the wp-config.php of your installation. Replace the content of your .htaccess with the block above.

It’s done? Click on the “Connect” link

Congratulations! Your WordPress site network is installed!

Let’s discover the new Back-Office of our newly installed multi-site WordPress.

Logo

The main change, as you may have noticed, is the appearance of a new menu, the network administration menu:

Here will be listed all the sites you can create on your site network as a Super-admin. Indeed, by activating the multi-site mode, a new role has been created, that of “Super-Admin”.

What is the “Super Admin”?

On a typical WordPress installation, we have the roles of “Subscriber”, “Contributor”, “Author”, “Editor” and “Admin”. The Administrator is the highest role, the one with the most rights on your installation. It is the user with this role who will be able to add, activate, delete an extension or a theme. He will also be able to completely configure your installation.

On a multisite installation, the installation of extensions and themes is done at the network administration level and not at the level of each site. So a new role was needed to manage this new level of administration.

If we summarize, an administrator will be able to manage his site while the super-administrator will be able to manage all the sites of the network as well as to install themes and extensions which will be available on all the network.

General principles of operation

Now your Multisite is installed but I won’t leave you like that!

Know that an extension like a theme is installed as a Super-admin on the network admin dashboard.

Know that an extension activated at the network level will be available on all the sites of your Multi-site BUT you can activate an extension site by site, or each site administrator can activate an extension on his site.

For themes, it works a little bit different, it must be active on the network to be activated on each site. So, if you have a theme and its child, you can activate only the child theme so that no changes are made to the “parent” theme.

One WordPress for several sites? Why not switch to domain mapping?

Setting up a multi-site – multi-domain WordPress at O2Switch

5 comments on “Multisite in WordPress: Why? How do I do it?

  • pat3

    Le tutoriel a le mérite d’exister, mais il s’abstient de traiter la principale difficulté du multisite Worpdress: le wildcard chez l’hébergeur si on veut créer des sites en sous domaine… un tutoriel était absolument nécessaire à l’époque du WPMU, mais là, si vous faites un tutoriel qui ne traite pas de la seule véritable difficulté, c’est un peu dommage…

    • Sebastien Serre

      Bonjour et merci de participer, remonter les infos.
      La création du sous-domaine Wildcard est effectivement a réalisé chez votre hébergeur et selon l’hébergeur les outils mis à disposition ne sont pas forcément les memes.
      Toutefois, le sujet du domaine Wildcard est abordé ici:

      Dans mon exemple ci-dessus, pour obtenir site1.tuto-multisite.local il vous faudra créer en DNS un wildcard avec le caractère astérisque (*) : *.tuto-multisite.local et le faire pointer sur le dossier contenant votre installation de WordPress.

  • pat3

    Merci pour votre réponse. J’ai bien lu la phrase ci-dessus dans votre tutoriel; mais telle quelle, soit on sait déjà ce qu’on fait (et on n’a pas vraiment besoin d’un tutoriel, du coup), soit ce n’est pas assez détaillé pour être appliqué; il manque un pas-à-pas de cette étape cruciale dans l’installation d’un multisite…

    • Greg

      Bonjour,
      je confirme la demande, en effet, cela me bloque.
      Je ne comprends pas certaines choses :
      1 – les “sous-sites” doivent avoir leur propre WP ? (car quand j’essai d’aller sur le tableau de bord de mon second site, impossible… car il n’a pas de WP).
      2 – J’ai essayé en configurant le Wilcard en CNAME ou A, dans les deux cas, c’est toujours pareil.
      Je suis sous OVH Plesk, si je créer un Alias avec redirection 301, ca renvoi sur le WP Admin du site principal, si je retire les redirections 301… alors je n’est plus de WP Admin pour mon second site.
      C’est incompréhensible….
      Sinon je dois créer un sous domaine dans lequel j’installe WP, mais ou est l’intéret du multi-site du coup?

      • Sebastien Serre

        Bonjour,
        le DNS Wildcard n’est pas autorisé par tous les registrars/hébergeurs et je ne peux pas lister les procédures pour chacun d’eux.
        Si votre fournisseur n’autorise pas le wildcard alors, faites une entrée DNS par sous domaine. Chaque entrée DNS doit pointer vers le même hébergement ou se trouve votre WordPress multisite. Une fois sur l’hébergement (dans le cas ou le DNS ne se gère pas via le même fournisseur), faites pointer les sous-domaines sur le même dossier contenant le WordPress multisite.
        Bon courage

Leave a Reply

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