2017-11-02 7 views
0

モバイルユーザーをモバイルサイトにリダイレクトするIISルールを作成しようとしています。 メインサイト(デスクトップ版)はルートルート( '/')にあり、モバイルサイトは '/ mobile'のルートにあります書き換えルールでIISがERR_TOO_MANY_REDIRECTSを取得しました

私はこのIISルールを作成しましたが、まあ、しかしモバイルでは、私はあなたのルールはまた、すべてのモバイルURLをマッチングされるので、それが起こっている

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="Rewrite Mobile" enabled="true" stopProcessing="true"> 
      <match url="(.*)" ignoreCase="true"/> 
      <conditions logicalGrouping="MatchAny"> 
       <add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" /> 
       <add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" /> 
       <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" /> 
      </conditions> 
      <action type="Redirect" url="mysiteurl/mobile" appendQueryString="false" /> 
     </rule> 
    </rewrite> 
    </system.webServer> 
</configuration> 

答えて

0

エラーがERR_TOO_MANY_REDIRECTSました。ルールからモバイルURLを除外する必要があります。この規則はあなたのために動作します:

<rule name="Rewrite Mobile" enabled="true" stopProcessing="true"> 
    <match url="mobile(.*)" negate="true"/> 
    <conditions logicalGrouping="MatchAny"> 
     <add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" /> 
     <add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" /> 
     <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" /> 
    </conditions> 
    <action type="Redirect" url="/mobile" appendQueryString="false" /> 
</rule> 
+0

、その後、私がしようとするたびに、それが仕事だが、私は私のラップトップ上でのモバイルバージョンを確認する最初の時間の後、(私はChromeデベロッパーツールでモバイルモードを設定)、およびルートルート( '/')にアクセスするにはモバイル( '/ mobile')を取得します –

+0

通常、ブラウザはリダイレクトをキャッシュしています。キャッシュをクリアする必要があります –

+0

私のソリューションがうまくいく場合は、 –

関連する問題