Hello guys,
I tried vkmaxx solution but It didn't work for me.
I solved adding:
#First condition, If is HTTPS without wwww, redirects to www.
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
#Second condition, If is not HTTPS and without www, redirects to HTTPS with WWW.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*) https://www.%{SERVER_NAME}/$1 [R,L]
#Third, If is not HTTPS and have www, redirects only to HTTPS
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]