简体   繁体   English

UrlRewrite模块中的重定向规则无法按预期的IIS工作

[英]Redirect rule in UrlRewrite module not working as expected IIS

the need is to redirect every non www hit to www urls and for doing that i have following rule 需要将每个非www命中重定向到www url,为此,我有以下规则

<rule name="WWW" enabled="true" stopProcessing="true">
        <match url="(.*)" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="^domain\.com$" />
        </conditions>
        <action type="Redirect" url="http://www.{HTTP_HOST}/{R:1}" />
    </rule>

what is does right now- it redirects every hit of non www url to my home page (www.domain.com) Expected- it should redirect domain.com/subpage to www.domain.com/subpage 现在该怎么做-将非www网址的每次匹配重定向到我的主页(www.domain.com)预期-应该将domain.com/subpage重定向到www.domain.com/subpage

you can try this,it's work for me 你可以试试看,对我有用

<rule name="www" >
    <match url="(.*)" ignoreCase="true" />
    <conditions>
        <add input="{HTTP_HOST}" pattern="^example\.com" />
    </conditions>
    <action type="Redirect" url="http://www.example.com/{R:1}" redirectType="Permanent" />
</rule>

the problem was with my New HAProxy LB cluster which was doing some sort of redirection with its own, redirect rule is fine. 问题出在我的新HAProxy LB群集上,该群集正在使用自己的重定向规则进行某种重定向。 fixed it with the help of IT 借助IT对其进行修复

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM