简体   繁体   中英

.htaccess http to https redirecting too many times

My domain is www.supergenscript.com. Its hosted on www.easycloud.us and all DNS has been configured using CloudFlare. I have the following code in my .htaccess file.

RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

Nothing except this there in my .htaccess file. This is the complete code my .htaccess has right now. I am using this code with the purpose to redirect from http to https automatically. Its changing from http to https but the index page is not loading. Instead, the browser keeps on loading and finally after spending some good amount of time it gives an error.

Here is the error received on my Google Chrome browser

This page isn’t working

www.supergenscript.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

Please help me find a solution to this problem. I am really getting frustrated.

try this:

RewriteCond %{HTTP:X-Forwarded-Proto} !http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

above solutions didn't work for me

Check this one

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Or This one

RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.supergenscript.com%{REQUEST_URI} [NC,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM