LUKIYA'S NEVERLAND

春去秋来,花谢花开。


HTTP跳转HTTPS

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

根域名跳转增加www前缀

<system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="test.com" />
            </conditions>
            <action type="Redirect" url="https://www.test.com/{R:0}" />
            </rule>
        </rules>
     </rewrite>
</system.webServer>