下载
根据USER_AGENT和域名条件来转向
<rule name="Social Rewrite" patternSyntax="ECMAScript" stopProcessing="true"> <match url="(.*)" ignoreCase="true" negate="false" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_USER_AGENT}" pattern="字符串" /> <add input="{HTTP_HOST}" pattern="^www\.domain1\.com$" /> </conditions> <action type="Redirect" url="http://www.domain2.com/{R:1}" appendQueryString="true" redirectType="Permanent" /> </rule>
重要地方
logicalGrouping="MatchAll" 表示全部符合才行,类似条件的串联 AND
logicalGrouping="MatchAny" 表示符合其一就可以,类似条件的并联 OR
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<httpRedirect enabled=”true” destination=”http://老域名/目录名/” exactDestination=”false” httpResponseStatus=”Permanent” />
</system.webServer>
</configuration>