'URL rewrite module IIS - redirecting act differently when I change rule name

Recently I have been facing very strange issue with IIS rewrite module. So, I am trying redirect one of URL to a desired URL.

<rule name="Redirect to merchant dashboard login page" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{CACHE_URL}" pattern="*://*/*/login*" />
                </conditions>
                <action type="Redirect" url="https://dev.mydomain.com/apply/{C:3}/login" />
</rule>

In IIS manager this rule look like this:

enter image description here

also, just for the reference, in IIS manager there is option to test the pattern with my URL. So I give a screenshot of it how it look like:

enter image description here

As you can see, from the above picture my pattern extracting backreference correctly. So, when I hit a URL which match with this pattern I am expecting it should redirect me to the URL stated in IIS redirect URL part. However, when I hit a URL for example "https://dev.mydomain.com/rms/login" it append lots of "apply" word to the redirected URL which is so weird. Like the image below:

enter image description here

while debugging the issue from the browser I have found that when I hit the URL it hit the url multiple times and each time it add the backreference {c:3} to the redirected URL as a result it does not work.

What is so strange is the when I just change the rule name "Redirect to merchant dashboard login page" to "Redirect to merchant dashboard signup page" it works perfectly, which is - it redirect me to my expected URL https://circle.dev-youlend.com/apply/{C:3}/login

I am not understanding how can a change in Rule name make it working, how can I make it working even when I change the rule name?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source