SSL and www - handling redirect from https://mysite to https://www.mysite

by Oliver Williams   Last Updated July 12, 2019 12:00 PM - source

So this is obviously a 2x2 matrix - www and non-www, against SSL and non-SSL.

I want all traffic to be directed to SSL and www.

Getting http://example.com and http://www.example.com over to https://www.example.com is simple; I just add this line in the <VirtualHost *.80> container:

Redirect / https://www.example.com

And it works. The problem is getting https://example.com over to https://www.example.com. I don't have a digital certificate for example.com - the cert is written for www.example.com!

I'm thinking anything I put inside the <VirtualHost *.443> wrapper (Rewrite Rules etc.) won't help because the cert validity is checked first. I'm wanting the redirect to happen BEFORE I get the scary-looking message below. How would I do this?

standard Chrome message for irregular cert



Related Questions


Redirecting https://www to https://non-www with Apache

Updated December 21, 2017 16:00 PM

SSL BAD CERT DOMAIN on www

Updated April 27, 2019 10:00 AM

Apache settings to prevent browser from redirect

Updated March 07, 2018 10:00 AM