Previously on the CogitActive Saga:
Turning my regular WordPress installation into WordPress Multisite was relatively straightforward . . . I was now the Network Super Admin.
WordPress Multisite allows you to have multiple websites using the same WordPress installation. However, turning a regular installation into WordPress Multisite doesn’t make a network (of sites) per se. As reported in Right Now, the dashboard widget that gives a real-time count of how many sites (and users) you have in your network, there was only one site1 in my network after enabling Multisite.
You have 1 site and 1 user.
As already leaked, in addition to the website for my podcast, I wanted to create a blog to unfold my podcasting adventure (almost) in real time. I could have created this blog within the main site, but I chose wittingly to have a blog with its own sub-domain instead. Anyway, how to create a new website in a subdomain-based WordPress Multisite?
Although it was not a struggle to activate the Multisite feature, some of my choices may well have an impact further down the road. For instance, I decided to go for a domain-based network, but not to configure wildcard subdomains. Hence, I will have to create a subdomain manually for each site – making things slightly more complicated.
On top of that, Let’s Encrypt was not offering wildcard SSL certificates at the time I set up my website. Without those certificates, which allow securing an unlimited number of subdomains on a single certificate, there was a problem when trying
to encrypt a subdomain created through a multisite install2. Fortunately, there was a workaround2.
Creating a new site
First, let me describe how simple the process would have been if I had configured a wildcard subdomain (and had a wildcard SSL certificate already in place). In that typical scenario, all I would have to do is complete three fields in the Add New Site screen (in WordPress) and click on the Add Site button. That is it. WordPress would have handle everything.
Now, let me unfold how I added the very site you are browsing right now.
The process, at least the beginning, is the same as for the scenario described above. I logged into my WordPress admin area (as a Super Admin), clicked on the My Sites link on the top-left corner of the admin bar and selected Sites in the drop-down menu. I clicked on the Add New button and I was facing the aforementioned Add New Site screen.
I filled in the Site Address (URL), the Site Title3, and the Admin Email fields and clicked the Add Site button. As I said, the exact same procedure as for the scenario described earlier.
I received a confirmation e-mail for the successful creation of my new site. However, the site was not immediately accessible (in contrast to what would happen with a wildcard subdomain in place).
I had now to create a matching subdomain (i.e. blog) via the control panel of my web host, namely SiteGround. Importantly, a domain-based network requires you
to configure your DNS (to map the domain name to the server’s IP address) and server (to map the domain name to the WordPress installation directory)4. Don’t worry if this technical jargon seems impenetrable; it is less complicated than it sounds.
I logged into my SiteGround User Area, navigated to my cPanel, and then clicked on the Subdomains icon (located in the Domains section). Once in the Subdomain tool, I typed in blog in the subdomain field. The field right next to it was already defaulted to my domain name. When I entered the subdomain name (i.e. blog), the Document Root field (located just below) populated automatically with this:
When you manually create a subdomain using cPanel, it creates a new document root at the same level as your public_html folder. Since WordPress Multisite needs to have all subdomains use the same directory in the server’s file system where WordPress is installed, you have to change the Document Root for your subdomain to the WordPress installation directory, i.e. public_html (without the subdomain folder).
This technical gibberish means that I had to delete the subdomain folder “blog” from the Document Root field – keeping only public_html/ – click on the Create button and voilà.
You have successfully created “blog.cogitactive.com”.
The subdomain was not only created, but also pointing to my WordPress installation. Moreover, the tool also handled the Domain Name System (DNS) configuration. The rest is done by WordPress, which
will then map the domain name to the site4. So much for the impenetrable instructions!
Still, it takes time for the new subdomain to propagate (see 48 hours!).
Encrypting the newly created subdomain
Now, as stated earlier in this post, Let’s Encrypt wildcard SSL certificates were not available (in SiteGround) when I created this site. Nonetheless, creating a
dedicated subdomain2 in cPanel (previous step) was all it takes to be able to install a regular Let’s Encrypt certificate.
As already described for my main domain (see Let’s Encrypt), the process couldn’t have been made any easier than with the tool provided by SiteGround. Still in cPanel, I navigated to the Let’s Encrypt icon (located in the Security section). I selected the subdomain from the drop-down menu and clicked on the Install button. That is it.
Let’s Encrypt certificate installation success.
As detailed in the aforementioned post, SiteGround also created a shortcut in the Let’s Encrypt tool that allows enforcing the certificate. As I did for the main site, I used this HTTPS Enforce tool to make my newly created website work over HTTPS. To make a long story short, this was not the best method to do so. Instead, I should have manually re-configure WordPress by editing the WordPress Address (URL) and Site Address (URL) fields, as previously discussed (see Let’s Encrypt). The procedure in a Multisite installation would have been slightly different, though.
In a regular WordPress installation, the two fields WordPress Address (URL) and Site Address (URL) that need to be edited are accessible via Settings > General. Guess what! In WordPress Multisite, these two fields are gone (or at least, no more accessible via Settings > General).
Instead, you have to reach the Site Options of the newly created website. To do so, you have to navigate to the Sites screen (My Sites > Network Admin > Sites), which lists all the sites within the network. If you hover your pointer over the name of the new site, you will see a list of links; click on Edit. This will bring you to the Edit Site screen. You will find the two aforementioned fields under the Settings tab.
All site settings are stored in this table. Do not edit anything here unless you know what you’re doing.The WordPress codex
Replacing “http” with “https” in the URL of a sub-site is one thing; you don’t want to adventure further, as warned by the codex. In particular, this method does not apply if you want to change the domain name in the URL; doing so can
break a portion or your entire site if all instances of your site’s URL aren’t changed in your database5. Likewise, this method doesn’t work with the main site because both fields are grayed out. In that case, you will also have to edit your database. I know. I have been there6.
I don’t know if two sites make a network, but Right Now – the dashboard widget – was positive:
You have 2 sites and 1 user.
To be continued…
1 This site, which was registered at the time of the WordPress installation, is now referred to as the main site of the “network” (i.e. the first one created). ^
2 Dan Maby (2016) WordPress multisite and Let’s Encrypt SSL. Virtual Assistant Life Magazine. ^
3 In keeping with the purpose of this blog – that is to allow YOU to follow my podcasting adventure (almost) live – the Site Title was originally “The making-of CogitActive”. Its intended purpose has not changed, but extended ever so slightly, hence its new title – “Beyond”. Anyway, it’s good to know that you can change the Site Title at any time. ^
4 See Before You Create A Network. ^
5 Jenni McKinnon (2015) The Complete Guide to the Site Options for WordPress Multisite Networks. wpmudev. ^
6 As teased at the end of Let’s Encrypt – footnote #10 to be specific – this is another story. ^