Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 301 set up which redirects to ($S$Q) but if I browse to I get an SSL error (as it expects

Is there any way to make it redirect before the browser throws a cert error?

share|improve this question

migrated from Sep 12 '09 at 1:42

This question came from our site for professional and enthusiast programmers.

isn't the cert bound to, therefore using the cert on is seen as a violation? I dunno, its how I always thought it was... – Will Mar 29 '09 at 17:03
Yes. I was hoping to have it redirect the user to before caring about the cert. As Brad says, this isn't possible. – Mr. Flibble Mar 29 '09 at 19:25
up vote 6 down vote accepted

Yes, but not how you think.

  • You will need a valid certificate for
  • You will need and to have separate public IP addresses

If you can't do that, you're out of luck, unfortunately. You can't use HOST headers to differentiate between the two requests, because that's far too late (thus, separate IP addresses). And unless you have a valid certificate, the browser is going to choke, so you also need the 2nd cert.

There's no way around these requirements, I'm afraid.

share|improve this answer

I had exact same requirement like redirect all to and also redirect all http to https, here how I achieved and get it working IIS 8.5. I used following code in web.config file:

  <!--Maybe some other settings-->
              <rule name="http to https" stopProcessing="true">
                  <match url="(.*)" />
                      <add input="{HTTPS}" pattern="^OFF$" />
                  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
              <rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true">
                 <match url="*" />
                   <add input="{HTTP_HOST}" pattern="" />
                 <action type="Redirect" url="{R:0}" />
  <!--Maybe some other settings-->

This worked like charm. Actually I generated above code in web.config by installing "URL Rewrite Module" using Web Platform Installer. After installation I found this module in IIS 8.5 then I added new rules. Hopefully, you can directly write this code in your web.config to get things done.

share|improve this answer

There is a way round it. You can get a single cert for both and Then you can use a regular redirect. These multi-domain certificates are generally more expensive though.

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.