iis 7 – IIS7 URL Rewrite – Add "www" prefix

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <!--<rule name="Add www" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" />
        <conditions>
        <add input="{HTTP_HOST}" pattern="test.com" />
          </conditions>
        <action type="Redirect" url="http://www.test.com/{R:0}" />
        </rule>-->
        <rule name="Add www" patternSyntax="ECMAScript" stopProcessing="true">
      <match url=".*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="^test.com$" />
        </conditions>
        <action type="Redirect" url="http://www.test.com/{R:0}" />
    </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注