RewriteEngine on RewriteCond %{HTTP:X-Forwarded-Proto} !=https RewriteCond %{HTTP:CloudFront-Forwarded-Proto} !=https RewriteCond %{HTTPS} !=on [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]