I have a website that I want to be only used with the WWW sub-domain and via HTTPS. I had an URL rewrite working for adding WWW. But now I also want to force a HTTP to HTTPS redirect. Just forcing HTTPS works as well, but when I can't really figure out how to combine the 2.
Can someone provide me with a working rule that redirects to https://www.domain.com in case the request is without WWW and/or via HTTP.
The problem was that I didn't have a certificate for the naked domain, only for www.mydomain.com. So when I was redirecting visitors from domain.com to www.domain.com the browser would still verify the certificate (missing) of the naked domain, and stop the redirect to show the warning screen.
Problem was fixed by simply adding the naked domain to my certificate.
I have been made a question months ago like it and answers may help you. Look at:
How to create a EXCEPT Rewrite Rule at IIS
I solved installing Rewrite module and creating a rule inside it. To install, you have to install:
http://www.iis.net/downloads/microsoft/url-rewrite