问题描述
||
我已经在这里和网络上浏览了许多建议,但仍然无法完成这项工作。我目前有以下情况,但是无法正常工作。所有帮助表示赞赏!
<rules>
<rule name=\"www-less redirect\" stopProcessing=\"true\">
<match url=\"(.*)\" />
<conditions>
<add input=\"{HTTP_HOST}\" pattern=\"^example\\.com$\" />
</conditions>
<action type=\"Redirect\" url=\"http://www.example.com/{R:1}\" />
</rule>
</rules>
解决方法
你的规则似乎是国际剑联。试试这个(略有不同)-对我来说效果很好:
<rule name=\"CanonicalHostName\">
<match url=\"(.*)\" />
<conditions>
<add input=\"{HTTP_HOST}\" pattern=\"^www\\.example\\.com$\" negate=\"true\" />
</conditions>
<action type=\"Redirect\" url=\"http://www.example.com/{R:1}\" />
</rule>
1)尝试将此规则移至顶部(使其成为第一条规则)。
2)可能(很可能)您对example.com
没有约束力,仅对www.example.com
具有约束力?