Skip to content

HTTPS subdomains

This is pretty much just ripped from this article.  But it took me forever to find a solution, so I’m writing this down!

It is possible to secure a sub-domain without a separate IP or SSL certificate but only if it is a wildcard certificate!  Just Host offers these, but what it doesn’t offer is decent support on the matter 😛

When you make a subdomain, say “sub.example.com”  going to http://sub.example.com – will be just fine.  But, going to https://sub.example.com will load up the contents of your default directory (a.k.a. public_html)  So, in order to get that to work you have to force it to point to the right directory using .htacces, like so:

1
2
3
4
5
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^sub.example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub-folder/
RewriteRule ^(.*) /sub-folder/$1
Published inOtherScripting

Be First to Comment

Leave a Reply

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