我正在尝试整天在IIS中创建URL重写规则,但我的规则都不起作用..
我想重写url来转换这些类型的Url
http://localhost:2811/Search/S%2fqIMmjstZg%3d/VehicleDetails.aspx
致http://localhost:2811/Search/VehicleDetails.aspx?mid=S%2fqIMmjstZg%3d
http://localhost:2811/Search/yYut%2f%2fBrHa8%3d/VehicleDetails.aspx
To
http://localhost:2811/Search/VehicleDetails.aspx?mid=yYut%2f%2fBrHa8%3d
http://localhost:2811/Search/nNLApdJeWJI%3d/VehicleDetails.aspx
To
http://localhost:2811/Search/VehicleDetails.aspx?mid=nNLApdJeWJI%3d
以下重写规则
<rewrite>
<rules>
<rule name="QueryString">
<match url="^Search/([_0-9a-z-%=\+\$]*)$/VehicleDetails.aspx" />
<action type="Rewrite" url="Search/VehicleDetails.aspx?mid={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
但它没有用......请帮助!!!
答案 0 :(得分:3)
你有错误的模式。我建议你关注:
/Search/([^/]*)/VehicleDetails.aspx$
现在解释(从结尾)