我通过godaddy为我的网站购买了SSL证书。如何强制我的网站始终加载https而不是http?

时间:2017-04-08 02:15:50

标签: ssl https

这是我的第一个网站。我获得了SSL证书,因此我可以托管我使用导航器方法进行位置服务的应用程序。但是我的网站自然不会加载到https上,除非我特意键入了s。如何使其始终安全加载?

编辑:已解决 这是我用godaddy托管

解决这个问题的链接

Link to godaddy help page

1 个答案:

答案 0 :(得分:1)

要强制所有网络流量使用HTTPS,请在根文件夹的 StringBuilder postData = new StringBuilder(); postData.Append("login=" + HttpUtility.UrlEncode("username") + "&"); postData.Append("password=" + HttpUtility.UrlEncode("password") + "&"); postData.Append("Submit=" + HttpUtility.UrlEncode("Login")); ASCIIEncoding ascii = new ASCIIEncoding(); byte[] postBytes = ascii.GetBytes(postData.ToString()); CookieContainer cc = new CookieContainer(); HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create("http://squirlytraffic.com/members.php"); webReq.Method = "POST"; webReq.ContentType = "application/x-www-form-urlencoded"; webReq.ContentLength = postBytes.Length; webReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"; webReq.CookieContainer = cc; Stream postStream = webReq.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Flush(); postStream.Close(); HttpWebResponse res = (HttpWebResponse)webReq.GetResponse(); HttpWebRequest ImgReq = (HttpWebRequest)WebRequest.Create("http://squirlytraffic.com/surficon.php?ts=1491591235"); ImgReq.Method = "GET"; ImgReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"; ImgReq.CookieContainer = cc; HttpWebResponse ImgRes = (HttpWebResponse)ImgReq.GetResponse(); Stream Img = ImgRes.GetResponseStream(); 文件中插入以下条件。

.htaccess