Hi,
In my IIS 7 configuration, I have created friendly URLs to convert:
http://mysite/restaurant.aspx?Name=SomeName
to
http://mysite/SomeName
To do this, I have the following rules:
<rule name="RedirectUserFriendlyURL1" enabled="true" stopProcessing="true">
<match url="^Restaurant\.aspx$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^Name=([^=&]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" enabled="true" stopProcessing="false">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern=".aspx" negate="true" />
</conditions>
<action type="Rewrite" url="Restaurant.aspx?Name={R:1}" appendQueryString="false" />
</rule>
- Does the above seem correct to achieve what I'm trying?
For some reason, on every postback I get:
Note that I have set appendQueryString to false.