2010-07-20 28 views
0

我有2個類似的重寫規則,即互相殺戮。類似規則的問題IIS 7重寫

這是我的規則:

<rule name="Product rewrite"> 
<match url="^product/([_0-9a-z-]+)/([0-9]+)" /> 
<action type="Rewrite" url="product.asp?id={R:2}" /> 
</rule> 

<rule name="Article rewrite"> 
<match url="^([_0-9a-z-]+)/([0-9]+)" /> 
<action type="Rewrite" url="article.asp?id={R:2}" /> 
</rule> 

現在的問題是,當我打電話頁是這樣的:

/產品/ 56小星星/ 14

然後頁的文章。 ASP被稱爲,而不是product.asp,但當我設置這樣的URL:

/product/56-little-stars/14 

然後一切都是對吧。那麼你能告訴我如何使所有2個重寫規則一起工作。我希望能夠調用的文章是這樣的:

/this-is-title-of-my-article/11 <-> article.asp?id=11 

,並呼籲產品這樣

/product/56-little-stars/14 <-> product.asp?id=14 

謝謝!

回答

0

如果我理解正確,你只需要添加stopProcessing =「true」,這樣一旦產品規則適用(這是更具體的),那麼它不會適用第二個。

<rule name="Product rewrite" stopProcessing="true"> 
+0

我這樣做,但現在當我稱之爲「/產品/ 56小星星/ 14」這是服用過多長時間,喜歡它的重定向或土地之前的東西它應該頁面上。誰能知道有什麼問題。 – Tjodalv 2010-07-21 12:20:41