Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automatic redirection to https?

Tags:

html

if i use:

<meta http-equiv="REFRESH" content="0;url=https://www.the-domain-you-want-to-redirect-to.com/index.html">

in the html code then it will endlessly loop and refresh the https page.

How can i redirect the users to https? [regarding one index.html file]

What do i need to put in the html code of that "index.html" to redirect them, if they use only "http"?

Thanks

like image 229
LanceBaynes Avatar asked Feb 10 '11 08:02

LanceBaynes


People also ask

How do I force HTTPS redirection?

In the Domains interface in cPanel (Home >> Domains), there's an option to enable Force HTTPS Redirection from the insecure version (HTTP) to the secure version (HTTPS) with a toggle switch.

Can you redirect HTTPS?

You will need to have a valid SSL certificate for https://www.example.com as the hostname is encrypted inside the HTTP header so your server won't know to redirect until it's decrypted. After that it should redirect as it would a normal HTTP request.

How do I stop auto redirect from HTTP to HTTPS in Chrome?

Go to chrome://net-internals/#hsts . Enter example.com under Delete domain security policies and press the Delete button. Now go to chrome://settings/clearBrowserData , tick the box Cached images and files and press click the button Clear data. This helped me as well!!!


1 Answers

var loc = window.location.href+'';
if (loc.indexOf('http://')==0){
    window.location.href = loc.replace('http://','https://');
}

maybe? as long as you don't mind a small javascript dependency.

like image 175
Brad Christie Avatar answered Oct 20 '22 04:10

Brad Christie