.htaccess redirect loop when trying to add forced HTTPS rule (Amazon Elastic Beanstalk)
I started receiving this error after trying to incorporate a rule to force HTTPS in the production environment. The BWC_ENV environment variable can have a handful of different values: "prod", "stage", "ben_local", "nam_local", etc. Here's my .htaccess: RewriteEngine On # Force HTTPS RewriteCond %{HTTPS} !=on RewriteCond %{ENV:BWC_ENV} ^prod$ RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Parse the subdomain as a variable we can access in our scripts RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} !^www RewriteCond %{HTTP_HOST} ^([^\.]+)\.([^\.]+)\.([^\.]+)$