Force https with Cloudflare Flexible SSL and WordPress

Once you’ve got your Cloudflare Flexible SSL certificate set up, you’ll need an .htaccess directive to force non-https URL’s to https. Here’s the one that worked for me

RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://www.domain.com/$1 [L]