2017-12-04 8 views
0

私のウェブサイトの(リダイレクト数)のヘルプが必要です。現時点では、3つの作業中のリダイレクトがあります。ウェブサイトのリダイレクトを減らす - web.config

WWWから非wwwバージョンへの移行です。 もう1つは非SSLからhttpsになります。
最後に、セキュリティを強化するためにServerヘッダーを削除しました。

これらは機能しますが、私のサイトは減速していると思います。リダイレクトを2に減らす方法はありますか?私はここでhttps://website.com

を探しています私のweb.configファイルである:

<configuration> 
    <system.webServer> 
     <staticContent> 
      <clientCache cacheControlMode="UseExpires" httpExpires="Tue, 19 Jan 2038 03:14:07 GMT" /> 
     </staticContent> 
     <rewrite>   
      <rules> 
       <clear /> 
       <rule name="Redirect to https" stopProcessing="true"> 
        <match url=".*" /> 
         <conditions> 
         <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
         </conditions> 
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> 
       </rule> 

       <rule name="Redirect to non-www" stopProcessing="true"> 
        <match url="(.*)" negate="false"></match> 
        <action type="Redirect" url="http://website.com/{R:1}"></action> 
        <conditions> 
         <add input="{HTTP_HOST}" pattern="^website\.com$" negate="true"></add> 
        </conditions> 
       </rule> 

      </rules> 
     </rewrite> 
     <rewrite>  
     <outboundRules rewriteBeforeCache="true"> 
      <rule name="Remove Server header"> 
      <match serverVariable="RESPONSE_Server" pattern=".+" /> 
      <action type="Rewrite" value="" /> 
      </rule> 
     </outboundRules> 

</rewrite>   
    </system.webServer> 
</configuration> 

私はこのような何かを思い付いたが、それが悪化しているようだ:ここで

<rules> 
<clear /> 
    <rule name="Redirect www and non-https to https://"> 
        <match url=".*" /> 
        <conditions logicalGrouping="MatchAny">       
         <add input="{HTTP_HOST}" pattern="^website\.com$" negate="true"></add> 
         <add input="{HTTPS}" pattern="off" /> 
        </conditions> 
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> 
    </rule> 
</rules> 

答えて

0

が私の答えです、私はそれが彼らのSEOで誰かを助けることを願っています。私が得 はの高値から下方にリダイレクト:

  • 3は、WWW、無WWW用
  • 1リダイレクトを使用するためのリダイレクト、
  • 2(WWW(HTTPS)にはWWWのため
  • 0リダイレクトをリダイレクト1の最大までHTTPS)

  • 図1に示すように、WWWのためのWWW用
  • 1リダイレクト、WWW用
  • 1リダイレクト(HTTPS)
  • 0私はちょうどSを追加する必要がないWWW(HTTPS)

ためのリダイレクトをリダイレクト 1行で{HTTP_HOST}を削除し、代わりにウェブサイト名を入力してください。

<rewrite>  
     <rules> 
      <clear />    
       <rule name="Redirect to https" stopProcessing="true"> 
        <match url=".*" /> 
         <conditions> 
          <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
         </conditions> 
        <action type="Redirect" url="https://website.com{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> 
       </rule> 

       <rule name="Redirect to non-www" stopProcessing="true"> 
        <match url="(.*)" negate="false" />     
        <conditions> 
         <add input="{HTTP_HOST}" pattern="^website\.com$" negate="true" /> 
        </conditions> 
        <action type="Redirect" url="https://website.com/{R:1}" /> 
       </rule> 

     </rules> 
</rewrite> 
関連する問題