I'm looking to redirect all of:
http://
http://www.
https://www.
to https://
This may have been answered here before, but having gone through the questions that seem relevant they are all not quite what I'm after, and everything I've tried resulted in a redirect loop or not working as hoped.
For example:
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.example.com
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
RewriteCond %{HTTPS_HOST} ^example.com
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
Thanks in advance for your help.