I want to direct visitors to the https url, so with the below code if a visitor types domain.com he will go to the https://www.domain.com
But if he types www.domain.com he will go to the https://www.www.domain.com
How can I avoid this?
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI}