IIS 7多域名主页规范重定向

5
在我们的web.config文件中,我们控制着6个不同的国际域名。
我们如何使用1个规则完成以下操作:
重定向
- www.1of6Domains.com/index.htm - www.1of6Domains.com/index.html - www.1of6Domains.com/default.asp - www.1of6Domains.com/default.aspx

- www.1of6Domains.com
类似于这样的操作?
<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>
1个回答

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>

将会有6个不同的域名使用相同的规则,因此这需要对所有域名都起作用。 - Brent

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接