【问题标题】:Web requesting forwarding to another domainWeb 请求转发到另一个域
【发布时间】:2019-05-23 19:04:18
【问题描述】:
我在 IIS 中设置了一个站点“MySite”,并使用以下 HTTP 绑定,
- www.example.com:80
- www.example.net:80
- www.example.org:80
我需要将所有访问www.example.net 的用户临时重定向到www.example.com/product。
任何想法如何实现这一目标?
【问题讨论】:
标签:
asp.net-mvc
iis
networking
【解决方案1】:
嗨,西瓦·桑卡尔·古拉姆,
您可以使用下面的 url 重写规则通过在 iis 中使用下面的 url 重写规则将 url www.example.net 重定向到 www.example.com/product:
<rule name=".net to .com" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example.net$" />
</conditions>
<action type="Redirect" url="http://www.example.com/product" redirectType="Temporary" />
</rule>
注意:如果你没有安装 Url rewrite 模块,请先安装它。