I have the following redirect rule defined in my .htaccess file:
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^example\.com*
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
When I try to use CloudFlare with my site, I get a redirect loop error (in my browser). Is there a way to modify the rules above to be compatible with CloudFlare?
The example at https://stackoverflow.com/a/34866168/2521519 looks like it's what I need but it doesn't seem to redirect to the www version of the url.