【问题标题】:IIS. How rewrite/redirect from url https://site1.com/Repo/* to https://site2.com/Repo/*?IIS。如何从 url https://site1.com/Repo/* 重写/重定向到 https://site2.com/Repo/*?
【发布时间】: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


    【解决方案1】:

    你可以试试这个规则,该模式使用正则表达式来检查 {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>
    

    【讨论】:

      猜你喜欢
      • 2019-11-15
      • 2015-06-09
      • 1970-01-01
      • 2014-11-26
      • 2015-08-26
      • 2016-06-18
      • 1970-01-01
      • 2016-03-20
      • 2017-09-10
      相关资源
      最近更新 更多