2012-04-15 153 views
0

請問我剛開始使用iis重寫模塊,我有一個任務用querystring重寫一個url。如何用URL重寫來重寫查詢字符串

我所要做的就是 http://www.blah.com/Pages/Content.aspx?id=n%2fWA2PJCJXXnu8mvdC0jXQ%3d%3d&ln=Gy7UlI4cSJE94Wa2qudbFQ%3d%3d

重寫URL以便像這樣http://www.blah.com/Pages/Content.aspx?id=Ecommerce

您好馬修感謝您的鏈接,但我沒有真正達到速度與URL重寫模塊我來了與此,它似乎並沒有工作

<rules> 
    <rule name="QueryStringRW" stopProcessing="true"> 
     <match url="^Content\.aspx$" ignoreCase="true" /> 
     <conditions> 
      <add input="{QUERY_STRING}" pattern="id=(\d+)" /> 
      <add input="{IDtoTitleMap:{C:1}}" pattern="(.+)" /> 
     </conditions> 
     <action type="Redirect" url="Content.aspx?id={C:1}" appendQueryString="false" redirectType="Permanent"/> 
    </rule> 
</rules> 
<rewriteMaps> 
    <rewriteMap name="IDtoTitleMap"> 
     <add key="id=n%2fWA2PJCJXXnu8mvdC0jXQ%3d%3d&ln=Gy7UlI4cSJE94Wa2qudbFQ%3d%3d" value="Id=Ecommerce" /> 
    </rewriteMap> 
</rewriteMaps> 

回答