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

Iis 7 IIS 7多域主页规范重定向,iis-7,canonical-link,Iis 7,Canonical Link,在我们的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" enabl

在我们的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>

我会选择:

<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流量):

编辑: 以下是处理多个域的规则(可以使用一个规则,但需要创建重写映射,但不确定您是否需要这种复杂性):


将有6个不同的域使用相同的规则,因此需要对所有域使用相同的规则。
<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>