在根目录下创建web.config文件:
1、如果访问域名是www.abcde.cn,则跳转到www.baidu.com。
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Enforce canonical hostname" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="false" pattern="^www.abcde.cn$" />
</conditions>
<action type="Redirect" url="http://www.baidu.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
2、多个访问域名跳转到www.abcde.cn
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Enforce canonical hostname" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^www.abcde.cn$" />
</conditions>
<action type="Redirect" url="http://www.abcde.cn/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
提示:所有跳转的域名与跳转后访问域名的解析地址相同。