I'm trying to add HSTS to my site. I added the line for it and then checked it here but it fails with "No HSTS header". The site is configured to use www and in researching this failure, it seems I have to redirect to non-www first. I already had the redirect to www so I added the redirect to non-www above it. If I check the header, the Strict code shows for the www link but not for the non-www link. Would someone please point out what I am missing or doing wrong?
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]