2011-09-13 50 views
4

我嘗試從這個網址rewitre的價值...IIS 7 URL重寫 - 獲得查詢字符串

/Search/VehicleDetails.aspx?vehicle=285584 

這一個

/VehicleAdvert/tella/Friend/285584 

到目前爲止,我已經與規則的玩弄和都這樣了,這不工作...

<!-- 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> 

我回來的URL是/VehicleAdvert/tella/Friend?vehicle=285584

什麼即時通訊之後是 - >/VehicleAdvert/tella/Friend/285584

任何人都可以提出哪裏即將出錯?

在此先感謝:)

Truegilly

回答

9

這解決了它

<!-- 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>