IIS7将http和http:// www重写为https [英] IIS7 rewrite http and http://www to https

查看:152
本文介绍了IIS7将http和http:// www重写为https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的应用程序切换到https。我添加了system.webServer重写规则

I switched my application to https. I added system.webServer rewrite rule

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
    <conditions>
      <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

我的web.config中的

in my web.config

它将 http://mydomain.com 重写为 https://mydomain.com 哪个好。
Bot如何让它重写 http://www.mydomain.com https://mydomain.com (没有www)

It rewrites http://mydomain.com to https://mydomain.com which is good. Bot how to make it to rewrite also http://www.mydomain.com to https://mydomain.com (without www)

推荐答案


  1. 你可以制定单独的规则这会将www.mydomain.com更改为mydomain.com

  1. You could make a separate rule that changes the www.mydomain.com into mydomain.com

你可以硬编码你的http_host而不是使用{HTTP_HOST}简单地放在那里:mydomain。 comso

You could just hardcode your http_host and instead of using {HTTP_HOST} simply put there: "mydomain.com" so

< action type =RedirectredirectType =Foundurl =https://mydomain.com/{R:1}/> ;

<action type="Redirect" redirectType="Found" url="https://mydomain.com/{R:1}" />

这篇关于IIS7将http和http:// www重写为https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆