# Force HTTPS RewriteEngine On RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301] # Force HTTPS without the "Too many redirects" error when behind proxy RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR] RewriteCond %{HTTP:X-Forwarded-Proto} ="" RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]