[英]HTTPS www redirects in web.config
我的web.config中有以下内容强制使用https;
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
但是我想强制www。 以及所有这些都将转到https:// www版本。 我需要实现的目标:
http://www.domain.tld/whatever
http://(no-www)domain.tld/whatever
https://(no-www)domain.tld/whatever
谢谢。
该规则将执行以下操作:
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="^www." negate="true" />
</conditions>
<action type="Redirect" url="https://www.example.com{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
您所需www.example.com
用您的域名更改www.example.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.