【问题标题】:how to set asp.net web.config rewrite http to https and www to non-www如何设置 asp.net web.config 将 http 重写为 https 并将 www 重写为非 www
【发布时间】:2015-06-18 07:32:39
【问题描述】:

我在重写部分非常菜鸟,希望有人可以帮助我。 现在我正在使用这个

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^(.*)" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{HTTPS}" negate="true" pattern="^on$" ignoreCase="false" />
      </conditions>
      <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="Found" />
    </rule>
  </rules>
</rewrite>

这个只能把http改成https,现在我希望它也能支持把www改成非www。我应该怎么做?

【问题讨论】:

    标签: asp.net url rewrite


    【解决方案1】:

    为什么来自 web.config?您应该从 IIS 允许它 - 只需添加它。

    【讨论】:

    • 我用的是共享主机,不能直接进入IIS,只能用web.config来设置。
    猜你喜欢
    • 2017-12-04
    • 1970-01-01
    • 2014-12-16
    • 2015-01-10
    • 1970-01-01
    • 2011-09-15
    • 1970-01-01
    • 2023-03-16
    • 2015-11-06
    相关资源
    最近更新 更多