【问题标题】:https URL Rewrite rewrites to domain root, does not keep url structurehttps URL Rewrite 重写到域根目录,不保留 url 结构
【发布时间】:2014-08-30 09:33:55
【问题描述】:

我正在尝试将 http 上的任何 url 重写为 https 等效项。

我的规则改写为https,但它默认回到域根目录,并且不保留url结构。

http://www.domain.com/dir1 -> 重写为 -> https://www.domain.com ,而不是 https://www.domain.com/dir1

<rewrite>
      <rules>
        <rule name="Redirect to https" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
        </rule>
      </rules>
 </rewrite>

【问题讨论】:

    标签: ssl iis-7 url-rewriting web-config iis-7.5


    【解决方案1】:

    这似乎完成了这项工作......

    <rewrite>
     <rules>
    
    
     <rule name="HTTP to HTTPS redirect" stopProcessing="true">
        <match url="(.*)" />
          <conditions trackAllCaptures="false">
                            <add input="{HTTPS}" pattern="off" />
          </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
     </rule> 
    
     </rules>
    </rewrite>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-19
      • 1970-01-01
      • 2014-06-08
      • 2021-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多