从http://重定向到https:// [英] Redirect from http:// to https://
本文介绍了从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
这篇关于从http://重定向到https://的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文