I am using CloudFlare and I want to force HTTPS and Non-WWW by using .htaccess
I know there are many examples online already, but for CloudFlare users, normal redirect may cause redirect loops.
The closest answer is this one: https://stackoverflow.com/a/34065445/1254581
But it only force HTTPS and I need to force non-WWW too. Please help to edit this rules:
RewriteEngine On
# If we receive a forwarded http request from a proxy...
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
# ...or just a plain old http request directly from the client
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
# Redirect to https version
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Put the rest of your rewrite rules here`enter code here`