IIS站点上多个域名做不同301跳转的实现
比如我在一台主机上的IIS站点绑定了两个域名a.com和b.com,现在都要做301要指向不同网址,那么如何写web.config呢?代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="301-1" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^a.com$" />
</conditions>
<action type="Redirect" url="a.com要跳转的域名/{R:0}"
redirectType="Permanent" />
</rule>
<rule name="301-2" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^b.com$" />
</conditions>
<action type="Redirect" url="b.com要跳转的域名/{R:0}"
redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<system.webServer>
</configuration>