RewriteCond %{HTTP_HOST} ^((www\.)?)domain\.tld$ [NC] RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://www.domain.tld/$1 [L,R=301]