从http://重定向到https://

问题描述:

我想将用户从我的http网站重定向到https站点,就像meta或JavaScript或html一样,我的站点具有http服务器以及安全版本.

I want to redirect users from my http website to https site is there like a meta or JavaScript or html to do this my site has a http server as well as a secure version.

作为快速修复,您可以像这样进行操作:

As a quick-fix you can do it like this:

if(window.location.protocol != 'https:') {
  location.href =   location.href.replace("http://", "https://");
}

但是我建议您使用Web服务器中的可用方法来完成此操作

But I recommend you to do it using the available method in your web server