How to set up HTTPS
William Entriken edited this page Mar 16, 2017
·
2 revisions
- First make sure you are using version 38 or higher.
- Enable the Let's Encrypt extension.
- Put this in your
.htaccess
file
RewriteEngine On
# https://www.drupal.org/node/2645198
RewriteRule "^.well-known/acme-challenge" - [L]
# HTTP -> HTTPS
# https://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite/4399158#300224
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect www.domain.com -> domain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]