How to set HSTS header from .htaccess only on HTTPS
snippet in htaccess

How to set HSTS header from .htaccess only on HTTPS

user3001

Header set Strict-Transport-Security "max-age=31536000" env=HTTPS

How to set HSTS header from .htaccess only on HTTPS

user4301

<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS
</IfModule>