【问题标题】:IIS rewrites URL even if I comment the rewrite rule on web.config即使我在 web.config 上注释重写规则,IIS 也会重写 URL
【发布时间】:2019-09-24 22:24:08
【问题描述】:

我有一个网站项目,它有一个 web.config,我通常会在其中注释这一系列行,只是为了避免在生产环境中应用 HTTPS 重定向:

<system.webServer>

[...]

<!--<rewrite>
  <rules>
    <rule name="Redirect to HTTPS" enabled="true" stopProcessing="false">
      <match url="(.*)"/>
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$"/>
      </conditions>
      <action type="Redirect" url="https://mywebsite.com/{R:1}" appendQueryString="true" redirectType="Permanent"/>
    </rule>
  </rules>
</rewrite>-->

</system.webServer>

即使注释了 sn-p,在调试期间,我也会在我的开发机器上从 http://localhost:53435/ 重定向到 https://mywebsite.com/

此行为不会在其他开发 PC 上发生。

我该如何解决这个问题?

【问题讨论】:

    标签: asp.net iis url-rewriting web-config


    【解决方案1】:

    这是一个 301 重定向代码,浏览器将其保存在内存中。

    只需在隐私浏览/隐身模式下尝试即可。

    如果问题在隐私浏览/隐身模式下已解决,请清除浏览器缓存以将其转为正常模式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-19
      • 2017-02-15
      • 1970-01-01
      • 2014-10-27
      • 2011-04-21
      • 2014-01-05
      相关资源
      最近更新 更多