'IIS match query string and append NTLM to the URL
I am trying to rewrite a URL once it matches the query string, unfortunately it doesn't rewrites to the desired URL. infact my rule does nothing. Can someone see what's wrong with the rule.
#First attempt:
<rule name="Rewrite to ntlm" enabled="true">
<match url="\?workid=(.*)" />
<action type="Rewrite" url="NTLM/{R:0}" />
</rule>
#Second attempt:
<rule name="Rewrite to ntlm" enabled="true">
<match url=".*" />
<conditions>
<add input="{QUERY_STRING}" pattern="workid=(.*)" />
</conditions>
<action type="Rewrite" url="NTLM/{R:0}" />
</rule>
Actual URL:
https://example.com/site/?workid=5555
Desired URL:
https://example.com/site/NTLM/?workid=5555
Solution 1:[1]
You can try this rule:
<system.webServer>
<rewrite>
<rules>
<rule name="test" stopProcessing="true">
<match url="^(.*)$" />
<action type="Redirect" url="/site/NTLM/?workid=5555" />
</rule>
</rules>
</rewrite>
</system.webServer>
If you have additional needs please let me know.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | samwu |
