I have recently purchased an SSL and installed it on my server. The conversion from http to https is done using the CloudFlare service, which is working perfectly fine. I did not have to worry about the redirection from http to https.
I have tried many .htaccess files posted in this community to force www but none of them worked appropriately. However, I have noticed that xenforo.com forces non-www all the time very well.
I would appreciate it if you can share the same .htaccess file so I can modify it to force www.