Install Wildcard SSL Certificates - cPanel

       Install Wildcard SSL Certificates - cPanel

Before installing this certificate, you should make sure the wildcard subdomain (* has been created in the control panel as well. This is required for proper functioning and installation of the SSL certificate.

Normally customers want their SSL configuration to look something like this: => /home/user/public_html => /home/user/public_html/order => /home/user/public_html/billing

We can setup only one SSL virtual host per IP address. However, we can mimic this behavior by using mod_rewrite rules. Here are the steps:

1) Install the wildcard SSL certificate as you normally do so the DocumentRoot is /home/user/public_html/ and the ServerName is *

2) Setup the following mod_rewrite rules in their .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/sub.domain.folder/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^
RewriteRule ^(.*)$ /sub.domain.folder/$1 [NC,L,NS]

* NC is nocase of course, unnecessary with a .* match but is inserted for paranoia sake.
* L is ‘last’ which stops rewriterule processing on match
* NS is ‘no subrequest’ which keeps internal URI’s from being reprocessed. This may help or break things and would require testing. Look for flash applets or javascripts that don’t load.

** If you are seeing 404 not found errors after adding these rules, check the errors and the path that the connection is trying to take. If you are seeing that the connections are forcing to an addon directory and not redirecting to the subdomain directory, you may need to add a symlink in the addon directory pointing to the subdomain directory due to the redirects not being able to escape doc root.For Example:

[Tue Dec 18 10:29:07 2013] [error] [client xx.xx.xx.xx] File does not exist: /home/sudosu/public_html/

ln -s /home/northlic/public_html/ /home/northlic/public_html/

3) Clear all of your browser cache and try accessing the subdomains.

That's it..:)