I need to do the following: My current address looks like: https://www.domain.com
I want to redirect with htaccess: www.domain.com TO https://www.domain.com and http://domain.com TO https://www.domain.com
I've tried with some suggestions here, but it ended up with the endless loop. I tried:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.domain.com [NC] RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]
Any help would be appreciated.
UPDATE: I think I've done it with the following:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]
Is that the right way to do it?