1
votes

I have domain E.g. 'example.com' I want to redirect all traffic to 'https://www.example.com' (as I have certificate that is only valid for 'www.example.com') when I type 'http://example.com' it worked fine and redirect me to 'https://www.example.com' as expected

Issue: When I make request with 'https://example.com' it does not redirected by rule to 'https://www.example.com'. Not sure why its failing with https?

Here is rule detail that i have applied.

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

1 Answers

-1
votes

Try this :

           <rule name="Add www" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="www.example.com" negate="true" />
                </conditions>
                <action type="Redirect" url="http://www.example.com/{R:1}" />
            </rule>