From: Mischa POSLAWSKY Date: Wed, 20 Oct 2021 22:20:26 +0000 (+0200) Subject: htaccess: https redirect on Upgrade-Insecure-Requests header X-Git-Tag: v1.13~130 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/2f80fb27bdfa2a66851d44ac6c66a64a3b82c97d htaccess: https redirect on Upgrade-Insecure-Requests header Enables encryption on most modern browsers as frequently recommended, without forcing (old or slow) clients if they don't need or want to. --- diff --git a/.htaccess b/.htaccess index 35296ee..f6a07f7 100644 --- a/.htaccess +++ b/.htaccess @@ -13,6 +13,11 @@ RewriteRule ^(vi(?=m$)|.*) http://sheet.shiar.nl/$1 [R=301] RewriteRule ^vim$ /vi [R=301] RewriteRule ^cc$ /countries [R=301] +# forward to https protocol if requested +RewriteCond %{HTTPS} =off +RewriteCond %{HTTP:Upgrade-Insecure-Requests} =1 +RewriteRule (.*) https://%{HTTP_HOST}/$1 [L] + # serve vim commands when requesting /digraphs.ex as well RewriteRule ^(digraphs)\.ex(/.*)?$ $1.vim$2