<rule name="replace query string" enabled="true" stopProcessing="true">
<match url="(.*)(ip=1)(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{QUERY_STRING}" pattern="(.*)(ip=1)(.*)" />
</conditions>
<action type="Redirect" url="{R:0}?{C:0}ip=0{C:2}" appendQueryString="false" logRewrittenUrl="true" />
</rule>
I have used the above rule and its creating duplicate query string
I have used below url
http://test.com/track/?ip=1&_=1589821794782
My main goal is to update the test.com to api.com and then change ip=1 to ip=0.
Can you please help me I'm new to this?
there is some issue in your rule pattern. you can see the below failed request tracing result of your rule:
to fulfill your retirement you could try to use below rule:
<rule name="replace query string" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="test.com" />
<add input="{QUERY_STRING}" pattern="ip=1(.*)" />
</conditions>
<action type="Redirect" url="http://api.com/{R:1}?ip=0{C:1}" appendQueryString="false" logRewrittenUrl="true" />
</rule>