如何设置 Web.config asp.net 将 HTTP 重写为 HTTPS,将 www 重写为非 www



我在重写部分很菜鸟,希望有人能帮助我。现在我正在使用这个

<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。我应该怎么做?

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

最新更新