![](/img/trans.png)
[英]URL rewrite rule (iis): redirect ONLY www.example.com and www.example.com/default.aspx
[英]How do can I code a rewrite rule in IIS 8 so that all traffic points to https://www.*.com from http://*.com?
我有以下根目录URL,人们可以去那里:
1. http://example.com
2. http://www.example.com
3. https://example.com
4. https://www.example.com
如何确保1、2和3始终使用IIS 8中的重写规则重定向到4? 当然,它应该保留附加的任何辅助信息(例如/images/myfile.jpg?query=string&another=string
)
你可以试试这个规则
<rewrite>
<rules>
<rule name="example.com to www.example.com" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="www.example.com" negate="true" />
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://www.example.com/{R:1}"
redirectType="Permanent" />
</rule>
</rules>
<rewrite>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.