Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7 URL Rewrite - get value of querystring

im trying to rewitre from this URL...

/Search/VehicleDetails.aspx?vehicle=285584

to this one

/VehicleAdvert/tella/Friend/285584

so far i have been playing around with the rules and have this, which doesnt work...

<!-- Tell a Friend -->
<rule name="Tell a Friend" stopProcessing="true">
  <match url="^.*(?:Search/VehicleDetails.aspx).*$" />
  <conditions>
    <add input="{QUERY_STRING}" pattern="vehicle=.*" />
  </conditions>
  <action type="Redirect" url="/VehicleAdvert/tella/Friend" redirectType="Permanent" appendQueryString="true" />
</rule>

The URL i get back is /VehicleAdvert/tella/Friend?vehicle=285584

what im after is -> /VehicleAdvert/tella/Friend/285584

can anyone suggest where im going wrong ?

thanks in advance :)

Truegilly

like image 357
JGilmartin Avatar asked Sep 13 '11 13:09

JGilmartin


1 Answers

this solved it

<!-- Tell a Friend -->
<rule name="Tell a Friend" stopProcessing="true">
  <match url="^.*(?:Search/VehicleDetails.aspx).*$" />
  <conditions>
    <add input="{QUERY_STRING}" pattern="vehicle=(\d+)" />
  </conditions>
  <action type="Redirect" url="/VehicleAdvert/tella/Friend/{C:1}" redirectType="Permanent" appendQueryString="false" />
</rule>
like image 69
JGilmartin Avatar answered Oct 15 '22 03:10

JGilmartin