a域名跳转到c域名 【 conditions logical逻辑条件 Redirect 更改 】
<rule name="301Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^a.com$" />
<add input="{HTTP_HOST}" pattern="^b.com$" />
</conditions>
<action type="Redirect" url="http://www.c.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="301Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^www.a.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.a.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="index" stopProcessing="true">
<match url="^index.html(多个文件用|割开)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://www.a.com" />
</rule>
将a目录及下面的所有路径跳转到根域名。【根域名/对应路径】 【 <action type="Redirect" url="http://www.a.com/b/index.html" />】
<rule name="index" stopProcessing="true">
<match url="^a" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://www.a.com" />
</rule>
<rule name="index23423434" stopProcessing="true">
<match url="^(.*)index.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="/{R:1}" />
</rule>
过滤bbs目录不被重写 ?
在最后<action type="Redirect"前一行添加:
<add input="{REQUEST_URI}" pattern="bbs" negate="true" />
过滤css,js,gif等文件不被重写 ?
<add input="{REQUEST_URI}" pattern="(.css|.js|.gif|.png|.jpg|.jpeg|.xml)" ignoreCase="false" negate="true" />