使用该功能需安装Url重写组件,这里提供百度云的存档

链接:https://pan.baidu.com/s/1FSSrxQgCDO1Rx4ZXIhMEMQ
提取码:dncd

        <!-- 封ip -->
        <rule name="Not Access" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REMOTE_ADDR}" pattern="100.100.100.100" />
          </conditions>
          <action type="CustomResponse" statusCode="403" statusReason="Forbidden: Access is denied." statusDescription="You do not have permission to view this directory or page using the credentials that you supplied." />
       </rule>
        <!-- 首页自动去除index.html -->
        <rule name="home" patternSyntax="ExactMatch" stopProcessing="true">
          <match url="index.html" />
          <action type="Redirect" url="/" appendQueryString="true" />
        </rule>
        <!-- 自动跳www -->
        <rule name="WWW Redirect d2" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^knifez.net$" />
          </conditions>
          <action type="Redirect" url="https://www.knifez.net/{R:0}" redirectType="Permanent" />
        </rule>
        <!-- m端自动跳https -->
        <rule name="mHTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^m.knifez.net$"/>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="https://m.knifez.net/{R:1}" />
        </rule>
        <!-- 自动跳m端 -->
        <rule name="yidongzy2" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_USER_AGENT}" pattern="android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|MQQBrowser|Windows Phone|wap" />
            <add input="{HTTP_URL}" pattern="\.html|\.htm|\.xml|/$"/>
          </conditions>
          <action type="Redirect" url="https://m.knifez.net/{R:0}" redirectType="Found" />
        </rule>
        <!-- PC自动跳https -->
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^www.knifez.net$" />
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="https://www.knifez.net/{R:1}" />
        </rule>