Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

If I use IIS will do as expected and redirect it to

If I use IIS will do as expected and redirect it to

But, if I use I get a certificate error.

How do I create a rewrite scripts to redirect www to HTTPS?

share|improve this question
Your question does not make sense. The construct is an URL, made up of a scheme (https) and a hostname ( When you write "How do I create a rewrite scripts to redirect 'www' to 'https'", it appears that you try to rewrite the non-canonical portion of the hostname (www) to a scheme. I've no idea why you want to do this, but can assure you that it does not make sense. Try expanding the question to include something about what you try to accomplish, rather than asking for directions for doing things that does not make sense. – Free Radical Jan 10 '13 at 15:44
Thanks for the feedback. I guess I am not sure how to write the question since I am not at all familiar with IIS, so I apologies for my ignorance. Could this be a certificate issue? Like I mentioned above the url works fine when typing "" or "http"//" into the browser and will redirect it to "https". However typing "" into the browser redirects to "https" but with a cerficate error. I am just trying to understand this. Thank- you. – user21346 Jan 10 '13 at 15:56
The fact that typing into the browser "works" is probably caused by two things, the first is that your browser in being nice and filling in the default scheme (http) for you, then IIS rewrites the scheme from http (insecure) to https (secure). If throws an certificate error, but not, this means that you have a valid ceritificate for but not for Why is the website set up to use a certificate (with is what https implies)? – Free Radical Jan 10 '13 at 16:04
Got it - thanks again. – user21346 Jan 10 '13 at 16:06

2 Answers 2

up vote 0 down vote accepted

You should check the common name on the certificate you purchased from your CA. While some CA's will give you a bonus subject alternate name of if you buy a certificate using common name of (and vice versa), others do not and your cert could just be bound to the common name of

Your certificate error doesn't look to be related to your redirect but to the common name bound to the certificate. Any web browser should give you the ability to view additional details on that certificate warning in order to determine why the warning is getting thrown.

share|improve this answer
Thank you. Yes, I just checked and the common name is "". I did notice that I have two certificates, one for "" and one for "". This all started when one expired and I had to renew it. I am sure I am the cause of my own problems here! – user21346 Jan 10 '13 at 16:49
Okay, I think I found the problem. It looks like "" is using the "" certificate, which I believe is throwing the certificate error when going to "". I realize this is all probably "first-grade" stuff to you guys, so I just want to say thank you for your help, comments and patients. – user21346 Jan 10 '13 at 16:58

You can strip the www from the URL using this method as outlined here.

Does your SSL redirect rule look similar to the following?

<rule name="Redirect all to HTTPS" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                    <add input="{SERVER_PORT}" pattern="443" negate="true" />
              <action type="Redirect" url="{R:0}" />
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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