iis url rewrite http->https non-www->www

时间:2023-03-10 01:55:38
iis url rewrite http->https non-www->www
<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirect abc.com to www" patternSyntax="ECMAScript" stopProcessing="true">
        <match url=".*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="^abc.com$" />
        </conditions>
        <action type="Redirect" url="https://www.abc.com/{R:0}" redirectType="Permanent" />
      </rule>
      <rule name="Redirect to abc.com https" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
        <match url="*" negate="false" />
        <conditions logicalGrouping="MatchAny">
          <add input="{HTTPS}" pattern="off" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>