中國站
幫助中心 > 安全 > SSL安全證書 > 證書安裝 > 使用程序強制跳轉到HTTPS

使用程序強制跳轉到HTTPS

兼容

  1. <!-- 如果檢測到是http頁面,則自動跳轉到對應的https頁面 -->
  2. <script type="text/javascript">
  3. if (document.location.protocol != "https:") {
  4. location.href = location.href.replace(/^http:/,"https:");
  5. }
  6. </script>

ASP

  1. <%
  2. If Request.ServerVariables("SERVER_PORT")=80 Then
  3. Dim strSecureURL
  4. strSecureURL = "https://"
  5. strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
  6. strSecureURL = strSecureURL & Request.ServerVariables("URL")
  7. Response.Redirect strSecureURL
  8. End If
  9. %>

PHP

  1. if(!isset($_SERVER['HTTPS'])||!$_SERVER['HTTPS']){
  2. $url ='https://'. $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'];
  3. header('Location: '. $url);exit;
  4. }
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女