RewriteEngine on RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-SSL} !on RewriteCond %{HTTP_HOST} ^xxx\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.xxx\.com$ RewriteRule ^/?$ "https\:\/\/www\.xxx\.com\/" [R=301,L]