I need a combination of redirects to achieve the following:
To redirect http://example.com to http://www.example.com, while redirecting https://www.example.com to https://example.com.
I would like to force the www prefix do the domain name when the site is accessed over http.
However the SSL certificate only works without the www.
When accessed over https, I don't want the domain name to have the www prefix.
Put this in your .htaccess file in your non-HTTPS document root:
And this in your HTTPS document root: