1
我試圖重寫/重定向URLURL重寫子域和目錄結構ASP.NET在ASP.NET 4.0 4.0
例子:
請求的URL :
http://www.domain.com/accounting/blog/post/2009/07/17/Getting-the-most-out-of-your-account-firm.aspx
重寫/重定向URL:
http://blog.domain.com/post/2009/07/17/Getting-the-most-out-of-your-outplacement-firm.aspx
換句話說,改變從「WWW」到「博客」子域名,並刪除「/會計/博客」,從目錄結構,然後重定向。
這裏是我使用的規則(通過在IIS模式匹配測試,但不工作):
<rewrite>
<rules>
<rule name="blog redirect" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="www\.domain\.com\/accounting\/blog\/(.*)" />
</conditions>
<action type="Redirect" url="http://blog.domain.com/{C:1}" />
</rule>
</rules></rewrite>
任何幫助將不勝感激。
謝謝你的回覆。這就像一個魅力! – jptrue 2012-03-15 12:46:29