2017-02-04 9 views
0

すべてをリダイレクトしようとしていますhttp://thesite.comhttp://www.thesite.comhttps://thesite.comからhttps://www.thesite.comです。しかし、私は正しいパターンを持っていません。私は間違って何をしていますか?HTTPからHTTPSへのリダイレクトの書き換え規則

<rewrite> 
    <rules> 
     <rule name="Redirect to HTTPs" enabled="true" stopProcessing="true"> 
      <match url="(.*)" /> 
      <conditions> 
       <add input="{HTTPS}" pattern="OFF" /> 
      </conditions> 
      <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" /> 
     </rule> 
    </rules> 
</rewrite> 

答えて

0

私は解決策を見つけた:

  <rule name="Redirect non-www OR non-https to https://www"> 
       <match url=".*" /> 
       <conditions logicalGrouping="MatchAny"> 
        <add input="{HTTP_HOST}" pattern="^thesite.com$" /> 
        <add input="{HTTPS}" pattern="off" /> 
       </conditions> 
       <action type="Redirect" url="https://www.thesite.com/{R:0}" redirectType="Permanent"/> 
      </rule> 
関連する問題