Force to https using htaccess , redirect many times error

i use this code to all traffic to https but it gives to many redirects error on my own domain althogh this code work correctly in domain. so tell me what is the problem

code inside my ‘’ file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Try using this code, taken up from hosting guides:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
and save it as an htaccess file on yourdomain/htdocs/.

Actually, this looks very similar to configuration we have in our official guides:

same problem after using this code

I checked your website and I also can’t seem to get rid of the redirection issue.

Can you please check your Cloudflare settings and make sure to delete or disable all page rules, automatic rewrites, automatic redirects and so on? With the right website configuration, you don’t need any of them, and tend to only cause unpredictable behavior like this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.