【问题标题】:IIS - HTTPS and WWW RedirectIIS - HTTPS 和 WWW 重定向
【发布时间】:2018-01-25 20:47:17
【问题描述】:

所以我使用 iis 8 并尝试将我网站的所有版本重定向到 1。

比如说:

http://www.osrshub.com
www.osrshub.com
osrshub.com
http://osrshub.com
https://osrshub.com
https://www.osrshub.com

当用户点击这些链接中的任何一个时,我需要它重定向到 1 个主链接。

https://www.osrshub.com

我使用的是 windows server 2012

【问题讨论】:

    标签: url iis url-rewriting


    【解决方案1】:

    此规则会将所有内容重定向到https://www.osrshub.com

    <rule name="All in one rule" stopProcessing="true">
       <match url=".*" />
       <conditions logicalGrouping="MatchAny">
          <add input="{HTTPS}" pattern="off" />
          <add input="{HTTP_HOST}" pattern="^www\.osrshub\.com$" negate="true" />
        </conditions>
        <action type="Redirect" url="https://www.osrshub.com/{R:0}" />
    </rule>
    

    您需要在您的 web.config 文件中添加此规则

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-13
      • 2020-05-22
      • 2021-12-03
      • 2016-05-31
      • 1970-01-01
      • 2020-12-09
      • 2013-06-11
      相关资源
      最近更新 更多