【发布时间】:2021-10-05 09:49:19
【问题描述】:
请告诉我如何在 IIS 上从 url https://site1.com/Repo/* 到 https://site2.com/Repo/* 进行重写/重定向?
我想要例如 https://site1.com/Repo/324234234234234 重定向到 https://site2.com/Repo/324234234234234
谢谢前辈
【问题讨论】:
标签: iis
请告诉我如何在 IIS 上从 url https://site1.com/Repo/* 到 https://site2.com/Repo/* 进行重写/重定向?
我想要例如 https://site1.com/Repo/324234234234234 重定向到 https://site2.com/Repo/324234234234234
谢谢前辈
【问题讨论】:
标签: iis
你可以试试这个规则,该模式使用正则表达式来检查 {HTTP_HOST} 是否等于 site1.com,动作中的 {R:1} 表示域名本身后面的 URL 中的任何内容.
<rule name="test1">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^site1.com$" />
</conditions>
<action type="Redirect" url="http://site2.com/{R:1}" />
</rule>
【讨论】: