• HSTS & URL rewrite

    From Bevan Robinson@21:1/5 to All on Thu Sep 16 20:18:59 2021
    I'm trying to enable HSTS and also force visitors onto https:// and include the www in any URL's. This is what I have in my .htaccess file. Is this correct?

    RewriteEngine On

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

    # If https send to https://www.
    RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
    RewriteCond %{HTTPS} on
    RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L]

    RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)