2012-03-14 14 views
1

は/ ASP.NET 4.0でURLをリダイレクトASP.NETでサブドメインやディレクトリ構造を書き直しURLは私が書き換えしようとしています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> 

任意の助けいただければ幸いです。

答えて

2

これは、任意のドメインのために動作します:

<rules> 
    <rule name="blog redirect" stopProcessing="true"> 
     <match url="^accounting/blog/(.*)" /> 
     <conditions logicalGrouping="MatchAll" trackAllCaptures="true"> 
      <add input="{HTTP_HOST}" pattern="^www\.(.*)" /> 
     </conditions> 
     <action type="Redirect" url="http://blog.{C:1}/{R:1}" /> 
    </rule> 
</rules> 
+0

は、返信いただきありがとうございます。それは魅力のように働いた! – jptrue

関連する問題