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>
2
  • Best practice is to use www.example.com Nov 7, 2015 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.
    – Jeremy
    Nov 8, 2015 at 21:12

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .