瀏覽代碼

301 to ssl

chendeben 8 年之前
父節點
當前提交
99f7fc24b8
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      www/index.php

+ 5 - 0
www/index.php

@@ -1,4 +1,9 @@
 <?php
+if($_SERVER['SERVER_PORT']=="80"){
+    Header("HTTP/1.1 301 Moved Permanently");
+    header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
+    die();
+}
 header("Content-Type:text/html; charset=utf-8");
 define("APP_PATH",dirname(dirname(__FILE__))."/app/");
 require_once APP_PATH.'conf/config.php';