I'm running a WP multisite using subdomains. I would like to force SSL protocol for all requests and am running into an issue for non-SSL requests on my child sites. I'm using the WP Force SSL plugin. I've done a bit of digging around and tried the following .htaccess directive, but it doesn't work (nor do anything):
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
For example:
- http://derpsite.tld = redirects to SSL Protocol
- https://derpsite.tld = works
- http://child1.derpsite.tld = breaks. Specifically, I get a
http://child1.derpsite.tld/cgi-sys/defaultwebpage.cgi
cPanel error page - https://child1.derpsite.tld = works
EDIT 1
I've reached out to both my host (dedicated server that has cPanel installed) and cPanel (the latter with whom I still have an open ticket). cPanel has mentioned:
Apache on cPanel is configured a bit different than other servers you may be used to. By default, Apache will accept any domain name being requested because it's set up as a wildcard. On cPanel servers, the virtualhosts are configured specifically for the domains you create. For example, when you created the cPanel account for defectslawyer.com, it set up a configuration that is specific to defectslawyer.com. Let's say I point the DNS for my domain thisisarealdomain.com to your server. When I make the request for thisisarealdomain.com, Apache checks it's configuration for that domain, doesn't find it, then returns the cPanel default page.
It sounds like you have DNS configured correctly, I'm assuming a wildcard subdomain record pointing to your server, but Apache doesn't know what to do with what's being requested. At least on the non-SSL side of things. What should solve the problem is to add a wildcard subdomain in cPanel [ https://documentation.cpanel.net/display/ALD/Subdomains ] so that the Apache vhost for *.derpsite.tld is added. Then, when anything.derpsite.tld is requested, Apache will be able to find that vhost and know what to load.
The reason SSL version may be working is you likely installed the SSL as *.derpsite.tld which creates that SSL vhost.
Based on this input I have:
- Added a wildcard subdomain within cPanel (and have the subdomain document root point to the main site root)...which now kicks out a
500 internal server error
for bothhttp://child1.derpsite.tld
andhttps://child1.derpsite.tld
) - I'm currently reviewing how I have my SSL set up
EDIT 2
The 500 internal server error
above seems to have been the result of installing my SSL on a wildcard domain; please see my 'answer' below