Drupal .htaccess force HTTPS /SSL and www. Prefix using mod_rewrite

Today a short snippet how to force SSL / HTTPS and www. prefix in front of URLs:

  1.   RewriteCond %{HTTPS} !=on
  2.   RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  3.   RewriteCond %{HTTP_HOST} .
  4.   RewriteCond %{HTTP_HOST} !^www\. [NC]
  5.   # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  6.   #webksde#JP20140227: Always HTTPS!
  7.   RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Kommentare

Drupal .htaccess force HTTPS /SSL and www. Prefix using mod_

I read this post completely concerning the difference of most recent and previous technologies, it's amazing article.