From: Stephen Cameron Date: Thu, 12 Aug 2021 13:19:10 +0000 (+0200) Subject: Set up HTTPS and canonical domain redirections. Done #4564 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f8c355397306350ccafb817744157d05a9f33bb8;p=nec-initiative-wordpress.git Set up HTTPS and canonical domain redirections. Done #4564 @0.25 --- diff --git a/.htaccess b/.htaccess index 77d4f34..1130147 100644 --- a/.htaccess +++ b/.htaccess @@ -1,3 +1,12 @@ +# Force HTTPS + redirect to non-www subdomain +# Ref: https://simonecarletti.com/blog/2016/08/redirect-domain-http-https-www-apache/ + +RewriteEngine On +RewriteCond %{HTTPS} off [OR] +RewriteCond %{HTTP_HOST} ^www\. [NC] +RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] +RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301] + # BEGIN WordPress # The directives (lines) between "BEGIN WordPress" and "END WordPress" are