Blog posts

    Enforcing HTTPS on a Drupal Site

    Submitted by allisonc on Sun, 07/15/2018 - 16:21

    I wanted to make sure that all pages on my site were accessed through HTTPS. This will forward to the HTTPS URL if it is not already being used.

    This is added to the .htaccess file at the /home/username
    # Redirect to HTTPS
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    it goes after:
    RewriteEngine on