Monday, February 20, 2017

Force HTTPS Rule

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Force HTTPS" enabled="true">
        <match url="(.*)" ignoreCase="true"/>
        <conditions>
          <add input="{HTTPS}" pattern="off"/>
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"/>
      </rule>
    </rules>
  </rewrite>
</system.webServer>