IIS URL 重定向更改查询字符串参数名称

IIS URL Redirect change querystring parameter name

我正在尝试从一个站点重定向到另一个站点,如下所示。

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

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

The domains are different. Also the redirect URL parameter and URL structure is entirely different.

我尝试了以下和其他一些变体。

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

这是固定的。我使用了以下内容。

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