0

I am currently redirecting http_example and http_www.example to https_www.example on IIS/Server 2016. The redirection works well with 2 rewrite rules. However, I am unable to figure out how to redirect https://example to https://www.example.

Appreciate your help. Thanks

VR1
  • 1
  • 2
    Possible duplicate of [IIS Redirect non-www to www AND http to https](https://stackoverflow.com/questions/32490426/iis-redirect-non-www-to-www-and-http-to-https) – James Jones Oct 10 '17 at 11:57

1 Answers1

0

You can achieve it even with one rule. In your case rule should be:

<rule name="All in one URL" stopProcessing="true">
   <match url=".*" />
   <conditions logicalGrouping="MatchAny">
       <add input="{HTTPS}" pattern="off" />
       <add input="{HTTP_HOST}" pattern="^www\." negate="true" />
   </conditions>
   <action type="Redirect" url="https://www.example.com{URL}" />
</rule>
Victor Leontyev
  • 8,488
  • 2
  • 16
  • 36