Cloudflare SSL Redirect Loop

IAmDaze

Junior Member
Joined
Sep 2, 2017
Messages
162
Reaction score
163
I am using cloudflare with a static page website. I am using htaccess redirect to move all traffic to https but this results in redirect loop. How to solve this?

My htaccess:
Code:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]
 
you can force https from cloudflare, it will work better.
 
I use https function on Cloudflare instead of the redirect script.
In crypto tab on Cloudflare, scroll down and you'll see something like "always https", turn it on, that's it.
 
Back
Top