咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
比如我在一台主机上的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>