If you force http to https redirection on your website, while using CloudFlare, with the following normal methods, a loop redirection occurs.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Normal Redirect via PHP