I always have to search for the correct apache rules. In this case I wanted http with www and https with www to go to https non-www.
Here's the snippet for you.
.htaccess
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]
Code language: JavaScript (javascript)