Jim
31 May 2010, 07:12 PM
I am trying to rewrite URLs on an IIS7 server (yes, the URL rewrite module is installed) and it works fine for simple rules, but I need it to work with a map. This is the code copied straight from the IIS website that I would have thought should work, but does not:
<configuration>
<system.webServer>
<rewrite>
<rewriteMaps>
<rewriteMap name="StaticRewrites" defaultValue="">
<add key="/randomtest1" value="/rewritten/index.phpi=1" />
<add key="/randomtest2" value="/rewritten/index.php?i=2" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Rewrite Rule">
<match url=".*" />
<conditions>
<add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="False" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sorry if the XML above formats strangely...
Anyone got any ideas on what might be wrong? Thanks!
<configuration>
<system.webServer>
<rewrite>
<rewriteMaps>
<rewriteMap name="StaticRewrites" defaultValue="">
<add key="/randomtest1" value="/rewritten/index.phpi=1" />
<add key="/randomtest2" value="/rewritten/index.php?i=2" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="Rewrite Rule">
<match url=".*" />
<conditions>
<add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="False" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sorry if the XML above formats strangely...
Anyone got any ideas on what might be wrong? Thanks!