我正在尝试从此地址重写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>结果如下:
查询参数加倍。
我遗漏了什么?
发布于 2019-11-06 04:30:25
我能够解决这个问题,我必须将{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
发布于 2019-11-05 11:17:43
请将{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>

https://stackoverflow.com/questions/58701899
复制相似问题