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=(.*)&amp;.*" />
                </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.

link|improve this question
feedback

1 Answer

It looks like your rule is using {C1}, but it should include a colon such as {C:1}

link|improve this answer
I knew it was something stupid. I ripped my hair for several hours but did not see it. Thanks! – Jonatan B Jul 19 '10 at 5:55
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.