IIS 7.5 URL rewrite redirect rule for old URL to new URL
I am trying to map this old webform URL
http://www.mysite.com/Listing.aspx?mlsnum=T5017910
to this new MVC URL:
http://www.mysite.com/listing?id=T5017910
Somehow I cannot get it to work. My rule is as follows:
<rule name="My Listing Redirect Rule" stopProcessing="true">
<match url="^Listing.aspx?mlsnum=([0-9a-z]+)" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="listing?id={R:1}" redirectType="Permanent" />
</rule>
Any help is appreciated开发者_StackOverflow中文版.
Your <match url=...>
need to escape the ?
character try this instead:
<match url="Listing.aspx\?mlsnum=([0-9a-z]+)" ignoreCase="true"/>
精彩评论