crx349 发表于 2014-3-23 13:36:34

IIS8 web.config 301跳转规则

分享一个iis8下的web.config规则


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
<security>
   <requestFiltering allowDoubleEscaping="true" />
</security>
       <rewrite>
        <rules>
<rule name="Redirect xmspace.net to www" patternSyntax="Wildcard" stopProcessing="true">
       <match url="*" />
       <conditions>
            <add input="{HTTP_HOST}" pattern="xmspace.net" />
       </conditions>
       <action type="Redirect" url="http://www.xmspace.net/{R:0}" />
</rule>
        </rules>
</rewrite>
      
    </system.webServer>
</configuration>


说明:将根域名跳转到www二级域名


crx349 发表于 2022-9-24 21:50:26

强制 https
      <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>
页: [1]
查看完整版本: IIS8 web.config 301跳转规则