.htaccess to enforce https without www.

If not using WordPress you may need to create your own .htaccess file for this.
So how do you forward?

http://example.com/
http://www.example.com/
https://www.example.com/
to
https://example.com/

Create a new .htaccess file and enter the following content:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [R=301,L,NE]
</IfModule>
<IfModule mod_headers.c>
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|flv|mp3|ico|pdf)$">
        Header unset Set-Cookie
        FileETag -INode MTime Size
        Header unset Last-Modified
        Header set Cache-Control "max-age=31536000, public, must-revalidate"
    </FilesMatch>
    <FilesMatch "\.(js|css)$">
        FileETag None
        Header unset Set-Cookie
        Header set Cache-Control "max-age=2592000, public, must-revalidate"
    </FilesMatch>
</IfModule>

As you can see there is also some other code added to prevent overweight from cookies and controlling a bit of caching.

Have a nice day!