2014-10-27 125 views
0

我试图设置从/ place/search-the-places/item-detail/id = 123到/ place/explore-our-places/item-detail/id = 123IIS重写URL参数

但它不工作,我做错了什么?

<rewrite> 
     <rules> 
      <rule name="Collections" stopProcessing="true"> 
       <match url="^place/search-the-places/item-detail/id=([0-9]+)" ignoreCase="true" /> 
       <action type="Redirect" url="/place/explore-our-places/item-detail/?id={R:1}" /> 
       <conditions> 
       </conditions> 
      </rule> 
     </rules> 
    </rewrite> 

谢谢!

回答

0

如果你只是想数字ID匹配作为参数,然后代替

id=([0-9]+)/([_0-9a-z-]+) 

使用

id=([0-9]+) 

,因为正则表达式的斜线意味着你的路线是这样的

/place/search-the-places/item-detail/id=123/end-of-route 

这是不正确的,我想。

也尝试使用type="Rewrite"而不是"Redirect"

+0

谢谢,我纠正这是我的坏,仍然没有运气 – Renaldas 2014-10-27 16:56:11

+0

也尝试使用type =“重写”而不是“重定向” – ZuoLi 2014-10-27 17:29:45

+0

仍然没有运气呢? – ZuoLi 2014-10-28 10:16:10