2016-05-30 95 views
1

我試圖從一個站點重定向到另一個,如下所示。IIS URL重定向更改查詢字符串參數名稱

http://example.com/quickscan/?code=123456 

https://example2.com/as-quickscan/login?username=123456 

疇是不同的。重定向URL參數和URL結構也完全不同。

我試過的是以下和其他一些變化。

<rule name="Redirect quickscan" stopProcessing="true"> 
    <match url="^quickscan/\?[a-zA-Z]+=([0-9]+)?$" ignoreCase="true" /> 
    <action type="Redirect" url="https://example2.com/as-quickscan/login?username={R:1}" appendQueryString="false"/> 
</rule> 
<rule name="Redirect quickscan" stopProcessing="true"> 
    <match url="^(.*)$" ignoreCase="false" /> 
    <conditions> 
     <add input="{QUERY_STRING}" pattern="^quickscan/\?[a-zA-Z]+?=([0-9]+)?$" /> 
    </conditions> 
    <action type="Redirect" url="https://example2.com/as-quickscan/login?username={R:1}" redirectType="Permanent" appendQueryString="false" /> 
</rule> 

回答

1

這是固定的。我使用了以下內容。

<rule name="Redirect quickscan" stopProcessing="true"> 
    <match url="^quickscan/" ignoreCase="false" /> 
    <conditions> 
     <add input="{QUERY_STRING}" pattern="([a-z]+)=([0-9]+)" /> 
    </conditions> 
    <action type="Redirect" url="https://klanten.hokra.nl/staalmarkt-quickscan/login?username={C:2}" appendQueryString="false" /> 
</rule> 
相關問題