0

I want to redirect https://example.com to https://www.example.com. I have the following rule for redirecting non www http traffic to https://www . . .

<rule name="WWW Redirect1" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^example\.com$" />
    </conditions>
    <action type="Redirect" url="https://www.example.com/{R:1}" />
</rule>

This will not handle redirecting from https://example.com to https://www.examlple. Right now I currently get the SSL cert error, is it even possible to avoid this?

1
  • The URL Rewrite module kicks in only after SSL connection is established. If you see an SSL warning when accessing example.com, then your certificate does not cover that domain name (as I understand it covers only subdomains *.example.com). Therefore you cannot redirect just like that -- you need to "fix" your certificate somehow (contact issuer about including example.com as well into a certificate). The only other way is to have another cert for example.com which has to be bound to another IP (IIS does not support more than one SSL certificate per IP:port combination).
    – LazyOne
    Sep 2, 2011 at 12:33

1 Answer 1

1

If you are getting an SSL certificate error, it likely means that either

  1. Your web server is not serving up an SSL certificate for https://www.example.com or;

  2. Your SSL certificate is for example.com not www.example.com. In which case, you'll likely need to address that with your SSL certificate provider.

Not sure that it is an issue with code or config....

1
  • The SSL error shows up for example.com because the cert is good for *.example.com but it will work fine for www.example.com. Aug 30, 2011 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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