Https redirecting not working

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Code from offical site is not working any sugestions how to solve this

https://infinityfree.net/support/how-to-force-all-traffic-to-https/

It would help a lot if you could explain a bit more about why you say it doesn’t work. What do you see when you try to use this code? Can you share the URL of your website so we can check if we see the same issue?

@elonmusk said:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Code from offical site is not working any sugestions how to solve this

https://infinityfree.net/support/how-to-force-all-traffic-to-https/

Try this one:

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

I’m pretty sure this will work! ?

Thank you all for help

@Admin said:
It would help a lot if you could explain a bit more about why you say it doesn’t work. What do you see when you try to use this code? Can you share the URL of your website so we can check if we see the same issue?

ERR_TOO_MANY_REDIRECTS is error page on browser.And I found tool and it counted 18 redirects.

@UnknownLolz said:

@elonmusk said:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Code from offical site is not working any sugestions how to solve this

https://infinityfree.net/support/how-to-force-all-traffic-to-https/

Try this one:

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

I’m pretty sure this will work! ?

Thank you for your suggestion but is not working i don know why.

Thanks @UnknownLolz and @Admin for help.
I hope so this info helps

@elonmusk said:
Thank you all for help

@Admin said:
It would help a lot if you could explain a bit more about why you say it doesn’t work. What do you see when you try to use this code? Can you share the URL of your website so we can check if we see the same issue?

ERR_TOO_MANY_REDIRECTS is error page on browser.And I found tool and it counted 18 redirects.

@UnknownLolz said:

@elonmusk said:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Code from offical site is not working any sugestions how to solve this

https://infinityfree.net/support/how-to-force-all-traffic-to-https/

Try this one:

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

I’m pretty sure this will work! ?

Thank you for your suggestion but is not working i don know why.

Thanks @UnknownLolz and @Admin for help.
I hope so this info helps

What’s your domain so that I can check?
Also are you using Cloudflare SSL?

@elonmusk
Elon Musk? Here? :wink:
If you are using CloudFlare you must enable the setting from there, called Always use HTTPS.
I also assume you have cleared your browser’s cache, huh?

@ChrisPAR said:
@elonmusk
Elon Musk? Here? :wink:
If you are using CloudFlare you must enable the setting from there, called Always use HTTPS.
I also assume you have cleared your browser’s cache, huh?

I am using CloudFlare SSL from Admin panel.
Also thank you for replaying.

@UnknownLolz
I cant give you the url beacuse I cant risck any page down.

How come Elon Musk didn’t know how to activate SSL when he can send things to space?

Try revert your .htaccess to its first state, then use Always Use HTTPS like @ChrisPAR stated above.

@Joo_Nath Elon Musk was try username to see if it will work so i am stuck with it for now haha

I needed to made a new .htaccess in one htdocs file becasue of main .htaccess is not editabel
Any thoughts how should I do it.

@Joo_Nath said:
How come Elon Musk didn’t know how to activate SSL when he can send things to space?
He has so much important things to do, that he cannot remember what to do with SSL.

Try revert your .htaccess to its first state, then use Always Use HTTPS like @ChrisPAR stated above.
Exactly, if you use CloudFlare then the .htaccess method is just a waste of time.
Just use the free tool already provided by CloudFlare, just one click, its much easier :smiley:!

Hi everyone I fix it

Problem was:

When I did my CloufFlare alteration in panel I was signed in on diffrent account,so I logged in that account set allways https and done.

Thanks anyone how helps.
@Admin @ChrisPAR @Joo_Nath

@Admin close this.

@elonmusk said:
Hi everyone I fix it

Problem was:

When I did my CloufFlare alteration in panel I was signed in on diffrent account,so I logged in that account set allways https and done.

Thanks anyone how helps.
@Admin @ChrisPAR @Joo_Nath

Are you really Elon Musk or is your name so?

@ChrisPAR

No !