2016-08-10 8 views
0

HSTS Preloadのすべてのテストに合格したいと思います。HSTS Preload Submission

まず:

`http://example.com` (HTTP) should immediately redirect to 
`https://example.com` (HTTPS) before adding the www subdomain. 
Right now, the first redirect is to `https://www.example.com/`. 

私のhtaccessファイルは、次のようになります。

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example.com$ [NC] 
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] 
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=302,L] 

セカンドを:

は、私は現在、私は解決する必要があること、2個のエラーを持っている

Response error: No HSTS header is present on the response. 

私のhtaccessファイルは、次のようになります。

<ifModule mod_headers.c> 
    Header add Strict-Transport-Security "max-age=84600; includeSubDomains" 
</IfModule> 

は、私が何をしないのですし、どのように私は試験に合格することができますか?

私はこのテストサイトを使用します。 https://hstspreload.appspot.com/

+0

サイトはヘッダはまた、apacheの中であなたのリダイレクトを設定する方法を見上げる – PeeHaa

+1

...どのように見えるかについての情報が含まれています。それは少なくともここで1000回答えられている。 – PeeHaa

答えて

2

これが正しいものである:あなたがリンクされ

RewriteCond %{HTTPS} off 
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

<ifModule mod_headers.c> 
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" 
</ifModule> 
+0

ありがとう!私はそれを試みましたが、URL http://domain.com/pageをhttps://www.domain.com/pageにリダイレクトしません。それをどうすれば解決できますか? –