Categories
WordPress How To

Add SSL / HTTPS for WordPress Network sub-site as cPanel Alias Domain

Site Address (URL)

We first change the Site Address (URL) of the sub-site.

Go to WordPress Multi-site: “My Sites” => “Network Admin” => “Sites” => Click “Edit” of the sub-site, and change the Site Address (URL) to the top level domain URL like this:

https://www.example.com/

Click “Save Changes“.

Domain Mapping (plugin)

A top-level domain is added to WordPress Network / Multi-sites via the Domain Mapping plugin. Add these top-level domains:

  • https://example.com
  • https://www.example.com (Primary)
  • https://www.example.com

However since the domain is not in the cPanel as an addon domain, AutoSSL will not issue SSL certificate for it.

cPanel Alias Domain + AutoSSL

The solution is, after adding the top-level domain in the Domain Mapping plugin, add it in cPanel as an Alias Domain for the WordPress Multi-site main domain (independent cPanel account).

Therefore AutoSSL will issue and install an SSL certificate for the alias domain. Go to “Manage AutoSSL” in WHM and “Run AutoSSL For All Users” to manually request SSL certificate for the alias domain.

It may take some minutes for the new certificate to be installed.

Really Simple SSL (plugin)

Now install the Really Simple SSL plugin, network activate it, and choose per site mode.

Go to the sub-site dashboard: “Settings” => “SSL” => Activate SSL

Done!

Optional .htaccess config

If you haven’t done the above step, below is optional and NOT required at all, otherwise below is required.

You can force HTTPS on the top-level domain in .htaccess of your WordPress network installation:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} yourtopleveldomain\.com
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . index.php [L]

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.