<?php
// 获取当前主机名
$currentHost = $_SERVER['HTTP_HOST'];

// 判断当前主机名是否包含指定的子域名
if ($currentHost == "520.100ufo.com" || $currentHost == "cdn.keaikeai.com") {
    // 检测当前协议，以保持重定向后协议不变
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
    
    // 构建新的URL，替换主域名
    $newUrl = "https://www.100ufo.com" . $_SERVER['REQUEST_URI'];

    // 执行301重定向
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: " . $newUrl);
    exit();
}
// 如果不包含上述子域名，当前URL保持不变，继续执行后续代码
?>
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', '1');

/**
 *  index.php PHPCMS 入口
 *
 * @copyright			(C) 2005-2010 PHPCMS
 * @license				http://www.phpcms.cn/license/
 * @lastmodify			2010-6-1
 */
 //PHPCMS根目录
/*
if($_GET[id]=='9999999999'){
header('HTTP/1.1 404 Not Found');
header('status: 404 Not Found');
die();
}
*/

//error_reporting(E_ALL);
//ini_set('display_errors', '1');


define('PHPCMS_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);

include PHPCMS_PATH.'/phpcms/base.php';
//if($_GET[m]=='member') die('404');


//if(strpos(addr_ip(),'江苏')!==false || strpos(addr_ip(),'长沙')!==false) die();

/*
if(strpos(get_url(),'https:')===false){
	header('HTTP/1.1 301 Moved Permanently');
	header("Location: ".str_replace('http://','https://',get_url()));
	die();
}
*/


pc_base::creat_app();

?>