I am trying to enforce https and www for my domain but it doesn't work for all the cases.
RewriteCond %{ENV:HTTPS} !=On [OR]
RewriteCond %{HTTP_HOST} !^(www\.)(.*) [NC]
RewriteRule (.*) https://www.example.com$1 [R=301,L]
Please let me know if am missing anything in my code.