RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} =example.com RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301]