2016-12-30 123 views
0

所以我的网址是 'http://localhost:1272/pdp/Gitanjali-1GMRose995-24KtGoldCoin?id=GR-995-1GM-12269'。如果URL包含单词“pdp”,我希望IIS重定向到某个页面。但是,由于这也可能作为我在URL中输入的产品名称的一部分出现,所以我希望IIS匹配/pdp/而不是仅仅使用pdp这个词。URL重写不正确IIS

这是我的尝试:

<rule name="test" stopProcessing="true"> 
     <match url="/pdp/" /> 
     <action type="Rewrite" url="/Product/ProductDisplay.aspx" logRewrittenUrl="true" /> 
    </rule> 


    <rule name="test" stopProcessing="true"> 
     <match url="\/pdp\/" /> 
     <action type="Rewrite" url="/Product/ProductDisplay.aspx" logRewrittenUrl="true" /> 
    </rule> 

这两个规则都无法匹配以下:
http://localhost:1272/pdp/Gitanjali-1GMRose995-24KtGoldCoin?id=GR-995-1GM-12269

我在做什么错?

+0

您可以请尝试: user3151766

回答

0

我找到了答案。由于pdp在url的开头,所以第一个/ in/pdp /不是必需的。删除并使条件为

<rule name="test" stopProcessing="true"> 
    <match url="pdp\/" /> 
    <action type="Rewrite" url="/Product/ProductDisplay.aspx" logRewrittenUrl="true" /> 
</rule> 

修复了这个问题。