
我想重寫一個網址:
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&embed=true&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&embed=true&installApp=false" appendQueryString="false" redirectType="Temporary" />
</rule>
</globalRules>
</rewrite>