2017-01-09 19 views
1

私は古いURL www.mydomain.com/customer/1を持っています。私はそのサーバーをww2に変更し、ww2.mydomain.com/customer/1に問題なく表示します。私の新しいIIS 8.5のwwwサーバでは、どのように書き換えルールを書き込むことができるのですか?ユーザがwww.mydomain.com/customer/1に行くと、ww2.mydomain.com/customer/1にリダイレクトされます。私はUrl Rewrite 2.0モジュールで多数のパターンを試しましたが、何も動作していないようです。私がリダイレクトしたくない他のwww要求はすべて、私の新しいwwwサーバに残ります。IIS URL別のサーバーに書き直します

答えて

0

私はあなたが、あなたがwww.mydomain.comサーバー上Web.configにこれを追加する必要があり、単一のパス、/customer/1をリダイレクトしたい:

<rewrite> 
    <rules> 
     <rule name="Redirect 'www.mydomain.com/customer/1' to 'ww2.mydomain.com/customer/1'" stopProcessing="true"> 
      <match url="^customer/1$" /> 
      <conditions> 
       <add input="{HTTP_HOST}" pattern="^www\.mydomain\.com$" /> 
      </conditions> 
      <action type="Redirect" url="http://ww2.mydomain.com{REQUEST_URI}" appendQueryString="false" /> 
     </rule> 
    </rules> 
</rewrite> 

あなたは追加のパスを含めたい場合は、あなたが指定した正規表現をいじることができます<match url="^customer/1$" />タグ。