本文介绍了IIS重写规则,将特定域的URL重定向到同一域上的不同URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只希望IIS 7.5重写规则重定向 www.domain/url1到 www.domain/url2 (相同的域).这可以通过以下方式实现:
I simply want an IIS 7.5 rewrite rule to redirect www.domain/url1 to www.domain/url2 (same domain). This can be achieved by:
<rule name="Redirect url" enabled="true" stopProcessing="true"> <match url="^url1" /> <action type="Redirect" url="www.domain/url2" appendQueryString="false" redirectType="Permanent" /> </rule>但是,此网站侦听多个域,因此以上内容已成为所有域的全局规则.我该如何特定于domain?尝试更改匹配网址并添加条件,但无法使其正常工作.谢谢.
However, this website listens to several domains, thus above becomes a global rule for all domains. How do I make this specific to domain? Have tried changing match url and adding conditions but cannot get it to work. Thanks.
推荐答案我可以这样工作:
<rule name="Redirect url1" stopProcessing="true"> <match url="^url1$" /> <conditions> <add input="{HTTP_HOST}" pattern="^(www.)?domain$" /> </conditions> <action type="Redirect" url="www.domain/url2" appendQueryString="false" redirectType="Permanent" /> </rule>更多推荐
IIS重写规则,将特定域的URL重定向到同一域上的不同URL
发布评论