Force HTTS redirect behind an AWS Elastic Load Balancer

If you want to force HTTPS for your site behind an AWS Elastic Load Balancer, place this in your .htaccess file, just after Rewrite Engine On: # Force HTTPS – Proto needed for AWS ELB RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker RewriteRule ^.*$ https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent] Advertisements