在我们的web.config文件中,我们控制了6个不同的国际域名。
我们如何使用1条规则执行以下操作:
重定向
到
这样的东西?
<rule name="Canonical Redirect" enabled="true" stopProcessing="true">
<match url="(.*)/(index.html|index.htm|default.asp|default.aspx)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="{R:1}" />
</rule>
答案 0 :(得分:1)
我会选择:
<rule name="Canonical Redirect" enabled="true" stopProcessing="true">
<match url="^index.html$|^index.htm$|^default.asp$|^default.aspx$" />
<action type="Redirect" url="/" />
</rule>
如果说www.1of6Domains.com你的意思是每个域可能不同,那么必须采取行动(请记住它假设非https流量):
<action type="Redirect" url="http://www.1of6Domains.com" />
修改强> 以下是处理多个域的规则(可以使用一个规则,但需要创建重写映射,不确定是否需要该复杂化):
<rule name="Canonical Redirect Non Https">
<match url="^index.html$|^index.htm$|^default.asp$|^default.aspx$" />
<action type="Rewrite" url="http://{HTTP_HOST}/" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
</rule>
<rule name="Canonical Redirect Https">
<match url="^index.html$|^index.htm$|^default.asp$|^default.aspx$" />
<action type="Rewrite" url="https://{HTTP_HOST}/" />
<conditions>
<add input="{HTTPS}" pattern="^ON$" />
</conditions>
</rule>