I am using the below script to redirect traffic to https. It work fine if I just type domain.com in the address bar but if I type www.domain.com it doesn't get redirected. How do I make it redirect both with and without www?
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]