【问题标题】:Possible to exclude subfolder from https rewrite?可以从 https 重写中排除子文件夹吗?
【发布时间】:2017-06-16 13:34:56
【问题描述】:

我有一个运行 https 的网站。现在有些程序员需要一个没有 https 的子目录。

这就是我现在的 web.config 中的内容:

<rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true">
    <match url="(.*)" ignoreCase="false" />
    <conditions>
        <add input="{HTTPS}" pattern="off" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>

我们需要从这个 https 重定向中排除文件夹“wp-content\rest”。

希望有人能帮我解决这个问题。

【问题讨论】:

    标签: http redirect https iis-8


    【解决方案1】:

    您需要在规则中添加附加条件:

    <rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true">
        <match url="(.*)" ignoreCase="false" />
        <conditions>
            <add input="{HTTPS}" pattern="off" />
            <add input="{REQUEST_URI}" pattern="^/wp-content/rest" negate="true" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
    </rule>
    

    那么这个规则将禁用重定向到所有像http://www.example.com/wp-content/rest*这样的url

    【讨论】:

      猜你喜欢
      • 2015-03-21
      • 2015-07-30
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 2010-12-06
      • 2018-07-31
      • 1970-01-01
      • 2023-04-03
      相关资源
      最近更新 更多