Im using IIS7 with the URL rewrite module and I can not make it work properly.
The rule looks like this in web.config
<rewrite>
<rules>
<rule name="Redirect to new enviroment" stopProcessing="true">
<match url="default.aspx" />
<action type="Redirect" url="http://www.example.se/play?id={C1}" appendQueryString="false" redirectType="Permanent" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{QUERY_STRING}" pattern=".*id=(.*)&.*" />
</conditions>
<serverVariables>
</serverVariables>
</rule>
</rules>
</rewrite>
and the url that is comming in is
http://www.example2.se/player/default.aspx?id=37185&metadatalanguageId=1
The result is that i am redirected to
http://www.example.se/play?id=
So the id (37185) is missing from the result.
When I use test pattern in IIS Manager it looks ok, and says that the back-reference {C:1} should contain the id.
What am I missing???
I have tried using "Failed Request Tracing Rules" but everything looks like it should work.
Best Answer
It looks like your rule is using {C1}, but it should include a colon such as {C:1}