分类目录归档:IIS

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>