0

I'm attempting to redirect all requests to my main site to https://example.com with VirtualHost. I want to remove the www from the domain and force https.

Currently all http:// requests are redirecting properly, but https://www.example.com is throwing an SSL privacy error.

I have a couple subdomains I'm hosting as well, so I assume virtualhost is the way to go?

Wondering if there's anything I can do, or if I'll need to purchase a second SSL cert just to support the https://www. redirect.

Current vhost.conf:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName example.com
    DocumentRoot /var/www/html
    SSLENGINE on
    SSL certs...
</VirtualHost>
  • Best practice is to use www.example.com – Jacob Evans Nov 7 '15 at 17:48
  • Ordinarily when you get a certificate for www.example.com it will include example.com as well, in the Subject Alternative Name field. The reverse may not be true. You should only need the one certificate, but you may have gotten the wrong one. – i40west Nov 8 '15 at 21:12
0

No there isn't a way around that, SSL socket opens before redirects are processed.

Some ssl providers give you www.example.com SAN free, contact them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.