RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP:X-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]