我正在尝试从该地址重写URL:
https://merchant.test-01.mysite.co/payment-gateway/vend?amount=69.90®ister_id=12¤cy=NZD
到此地址:
https://mysite.co/nz/test-01/merchant/payment-gateway/vend?amount=69.90®ister_id=12¤cy=NZD
我尝试:
<rule name="test01Generic" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(\S+?).test-01.mysite.co$" />
</conditions>
<action type="Redirect" url="https://mysite.co/nz/test-01/{C:1}" redirectType="Found" />
</rule>
结果如下:
https://mysite.co/nz/test-01/merchant?amount=69.90®ister_id=12¤cy=NZD
缺少payment-gateway/vend
的地方
还有这个
<rule name="test01Generic" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(\S+?).test-01.mysite.co$" />
</conditions>
<action type="Redirect" url="https://mysite.co/nz/test-01/{C:1}{REQUEST_URI}" redirectType="Found" />
</rule>
结果如下:
查询参数加倍。
关于我想念什么的任何想法吗?
答案 0 :(得分:0)
请将{REQUEST_URI}修改为{URL},并将appendQueryStrin保留为true,则可以。
<rule name="test0Generic" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(\S+?).test-01.mysite.co$" />
</conditions>
<action type="Redirect" url="https://mysite.co/nz/test-01/{C:1}{URL}" appendQueryString="true" redirectType="Found" />
</rule>
答案 1 :(得分:0)
我能够解决这个问题,我不得不将{REQUEST_URI}
更改为{PATH_INFO}
<rule name="test01Generic" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(\S+?).test-01.mysite.co$" />
</conditions>
<action type="Redirect" url="https://mysite.co/nz/test-01/{C:1}{PATH_INFO}" redirectType="Found" />
</rule>
现在,当调用下面的地址时:
https://merchant.test-01.mysite.co/payment-gateway/vend?amount=69.90®ister_id=12¤cy=NZD
我要重定向到此地址:
https://mysite.co/nz/test-01/merchant/payment-gateway/vend?amount=69.90®ister_id=12¤cy=NZD