How do I force browsers to enter my website with HTTPS? It automatically enters with HTTP!

Website URL

Hello, if someone types in the browser only it takes them to HTTP:// and therefore the website is not secure. But if I enter HTTPS it works fine. How can I make it so that when I enter my domain it leads to HTTPS?


Other Information

(other information and details relevant to your question)

You need to correct visitors to https:// protocol.
If you connect to your site with:
it shows it as secure.

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:CF-Visitor} !{"scheme":"https"}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Insert this code into your .htaccess and it will force all traffic to HTTPS.
(found from How to force all traffic to HTTPS)


Thank you, I have read the tutorial. I had a .htaccess in the root folder, but the file said not to write it… I had to overwrite it by creating another one in htdocs. That’s what I did. I created a .htaccess that contains only the text you quote from the tutorial. My question is… I have another folder with the name of my site (and another htdocs inside), should I do something in that folder? (probably because of my domain) thanks and best regards.

I guess it takes a while to update but for now I don’t notice any changes… Do you guys get https on my site?


Make sure .htaccess has the correct https redirect


Please show the .htacces content in this folder

hello, how should i do that? Finally I have entered the folder sanacionpendulohebreo, inside there is an htdocs, and I have created there an .htacess with the lines of code from the tutorial.

Do I delete the other .htaccess that I created in the “htdocs” folder sibling of sanacionpendulohebreo? leaving only the .htaccess that is in the htdocs child of the sanacionpendulohebreo folder?

Can you change to this code instead?

RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP:CF-Visitor} !{"scheme":"https"}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

ok, i just put that in / htdocs / htaccess file

is that the right path?

there is another htdocs folder at the same level of (here I didn’t put any htaccess file)

update: still the same it seems…

If I click through the forum link it works. If I write in my browser in incognito mode doesn’t work.

Why? Mmm

The .htaccess codes provided to you were incomplete. You need to have the line RewriteEngine On at the top of the file for the code to work.


OK done

Let’s see how it goes thank you

But for what I am seeing the problem still :frowning:

My path where I have my htaccess file it’s OK?

Currently I have

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:CF-Visitor} !{“scheme”:“https”}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] /htdocs /htaccess

Currently it seems doesn’t work

Update : incĂłgnito mode works at least for me now

All seems OK to me. When accessed without HTTPS, it’s redirecting people to HTTPS.

Are you still able to access your website without HTTPS?

Also, please make sure to clear your browser cache.

1 Like

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