我想要这些url重定向。
示例1:
http://wwww.old.com/News/List来http://wwww.new.com/News/List
示例2:
http://wwww.old.com/News/List?page=1& type = 2
http://wwww.new.com/News/List?page=1& type = 2
示例3:
http://wwww.old.com来http://wwww.new.com
<rewrite>
<rules>
<rule name="site2.com" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="http://wwww.old.com" />
</conditions>
<action type="Rewrite" url="http://wwww.new.com/{R:0}" />
</rule>
</rules>
</rewrite>
{HTTP_HOST}应该匹配wwww.old.com
而不是http://wwww.old.com
,您可以将rewrite
更改为redirect
,此规则您可以用作参考:
<rule name="test" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^wwww.old.com$" />
</conditions>
<action type="Redirect" url="https://wwww.new.com/{R:0}" appendQueryString="true" />
</rule>