【发布时间】:2016-02-11 17:14:41
【问题描述】:
我正在使用 web.config 将所有 HTTP 流量重定向到 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>
这很好用。
我的客户希望我现在将大量其他非 HTTPs .com 域重定向到这个 HTTPs .co.uk 域。
我找到了一个重定向脚本:
<rule name="Redirect to www.MYDOMAIN.co.uk" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^(www.)?MYOTHERDOMAIN1.(com|org)$" />
<add input="{HTTP_HOST}" pattern="^(www.)?MYOTHERDOMAIN2.(com|net|org)$" />
</conditions>
<action type="Redirect" url="http://www.MYDOMAIN.co.uk/{R:0}" />
</rule>
在我的一生中,我似乎无法将这些脚本组合成一个脚本来选择他的任何域并将它们清晰地指向 HTTPs .co.uk 域的方向。
任何想法都将不胜感激,因为正则表达式不是我的强项。
亲切的问候
【问题讨论】: