IIS URL 重寫不傳遞參數

IIS URL 重寫不傳遞參數

我想重寫一個網址:

blah.com/web/code=BSIL

對此:

blah.com/web/logon.html?app=BSIL&embed=true&installApp=false

它適用於重定向,但使用重寫時,參數不會被傳遞。

我嘗試過使用條件和重寫映射來完成範例,但這變得很混亂,我無法讓它工作,所以我認為我應該從頭開始以保持簡單。

規則:

<rewrite>
    <globalRules>
        <rule name="test" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*web/code=BSIL" />
            <action type="Rewrite" url="{R:1}/web/logon.html?app=BSIL&amp;embed=true&amp;installApp=false" appendQueryString="false" />
        </rule>
        <rule name="redirect" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*web/code=EC" />
            <action type="Redirect" url="{R:1}/web/logon.html?app=EC&amp;embed=true&amp;installApp=false" appendQueryString="false" redirectType="Temporary" />
        </rule>
    </globalRules>
</rewrite>

使用重定向的 Chrome 螢幕截圖

使用 Rewrite 的 Chrome 螢幕截圖

相關內容