how to set asp.net web.config rewrite http to https and www to non-www

♀尐吖头ヾ 提交于 2019-12-13 05:27:21

问题


I m very noob on the rewrite part, hope someone can help me. Now i m using this

<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>

This only can change http to https only, now I hope it can support to change www to non-www too. What should I do to do it?


回答1:


Why from web.config? You should allow it from IIS - just add it.



来源:https://stackoverflow.com/questions/29597716/how-to-set-asp-net-web-config-rewrite-http-to-https-and-www-to-non-www

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!