Skip to content

How to set up HTTPS

William Entriken edited this page Mar 16, 2017 · 2 revisions

In cPanel

  1. First make sure you are using version 38 or higher.
  2. Enable the Let's Encrypt extension.
  3. 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]
Clone this wiki locally