我试过各种重写URL,但无法让IIS发送以下URL https:/example.comdefault.aspxdefault.aspx。 到 https:/example.comdefault.aspx
Google用错误的URL索引了这个网站,而Bing却把它弄对了(去想)。任何帮助将是非常感激的。我所有的流量是去错误的网址(https:/example.comdefault.aspxdefault.aspx。).
<rewrite>
<rules>
<rule name="Redirect www.xxx.com to xxx.com" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^https://example.com/default.aspx/default.aspx" />
</conditions>
<action type="Redirect" url="default.aspx" />
</rule>
<rule name="redirect two character to default" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{URL}" pattern="^/[a-z]{2}(/)?$" />
</conditions>
<action type="Redirect" url="default.aspx" appendQueryString="false" />
</rule>
</rules>
</rewrite>
你的规则有一些问题。{HTTP_HOST}只匹配主机名,也就是www.example.com,不会匹配整个URL。
你可以试试下面的规则。
<rule name="Redirect www.xxx.com to xxx.com" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="www.example.com" />
<add input="{HTTPS}" pattern="on" />
<add input="{REQUEST_URI}" pattern="default/default|default.aspx/default.aspx" />
</conditions>
<action type="Redirect" url="default.aspx" />
</rule>