title: Warning: Unnecessary HSTS header over HTTP
body: <p>I want to use <strong>https</strong>:// and <strong>non www.</strong> URL always. So I used the following code in my htaccess file. But i am getting an warning from <a href="https://hstspreload.org" rel="noreferrer">https://hstspreload.org</a></p>
  
  <pre><code>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]    
  
  &lt;ifModule mod_headers.c&gt;
  Header always set Strict-Transport-Security "max-age=31536000;
  includeSubDomains; preload" 
  &lt;/ifModule&gt;
  </code></pre>
  
  <p>Warning Message is given bellow : </p>
  
  <p><strong>Warning:</strong> Unnecessary HSTS header over HTTP<br/>
  The HTTP page at <a href="http://mysiteurl.com" rel="noreferrer">http://mysiteurl.com</a> sends an HSTS header. This has no effect over HTTP, and should be removed.</p>
  
  <p>Please help me to <strong>rid the above warning</strong>. I tried with the following code also but it does not work <a href="https://stackoverflow.com/questions/38235475/how-to-disable-hsts-header-with-http">#ref. topic</a> </p>
  
  <pre><code> Header always set Strict-Transport-Security "max-age=31536000; 
   includeSubDomains; preload" env=HTTPS
  </code></pre>