【问题标题】:How to force https in IIS on windows server without any "/" problem?如何在没有任何“/”问题的情况下在 Windows 服务器上的 IIS 中强制 https?
【发布时间】:2021-11-12 22:28:19
【问题描述】:

我在 Windows 服务器上运行 iis,并且安装了有效的 ssl。 我完全按照here 所说的那样强制 https

它将http://example.com 重定向到https://example.com/ 但这也增加了另一个问题 通过将http://example.com/example/ 重定向到http://example.com//example/(另一个“/”是额外的) 它没有给出任何错误,但我不喜欢它发生,我在 apache 时从未遇到过这样的事情,但它发生在 iis 中。我只想将 http 更改为 https 而不是“/”。

我就是这样配置https://www.ssl.com/how-to/redirect-http-to-https-with-windows-iis-10/

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: redirect iis https iis-10


【解决方案1】:

如果要去掉url末尾的“/”,可以使用如下规则:

<rule name="Remove trailing slash" stopProcessing="true">
  <match url="(.*)/$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
 <action type="Redirect" url="{R:1}" redirectType="Temporary" />
</rule>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-02
    • 1970-01-01
    • 2016-03-27
    • 2021-07-17
    相关资源
    最近更新 更多