I have tried several different redirect configuration in .htaccess to redirect all traffic to the https non-www URL of my site but can't get https://www.example.com to redirect to https://example.com.
To be clear I want:
http://example.com
http://www.example.com
https://www.example.com
to redirect to
https://example.com
http to https://example.com works fine
EDIT:
I can't remember the various combinations I used.
This is what I have set at the moment
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
</IfModule>