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

Generated URL http://test.com/track/?ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=0&=1589821794782&ip=1&=1589821794782

enter image description here

1
  • If you feel my answer helps you, please mark it as an answer. This will help other people who face the same issue. Commented May 20, 2020 at 2:25

1 Answer 1

1

there is some issue in your rule pattern. you can see the below failed request tracing result of your rule:

enter image description here

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>
Sign up to request clarification or add additional context in comments.

2 Comments

How did you check the request tracing result? Can you please let me know how to do this? @jalpa-panchal
@ShajinChandran you could refer this link how to do failed request tracing in iis for the URL rewrite module learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.