簡體   English   中英

UrlRewrite模塊中的重定向規則無法按預期的IIS工作

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

需要將每個非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>

現在該怎么做-將非www網址的每次匹配重定向到我的主頁(www.domain.com)預期-應該將domain.com/subpage重定向到www.domain.com/subpage

你可以試試看,對我有用

<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>

問題出在我的新HAProxy LB群集上,該群集正在使用自己的重定向規則進行某種重定向。 借助IT對其進行修復

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM