|
Thanks hew
这就是个二级域名的转发啊.
首先加一个 *.Linuxsky.net 的A 记录让dns 支持泛解析,然后虚拟主机配置文件里加ServerAlias *.linuxsky.net.
最后PHP程序读" _SERVER["HTTP_HOST"] " 读出后再去比对做跳转.
这是phpwind blog 里的一段代码
代码:
[code:1]
$pre_host=substr($_SERVER['HTTP_HOST'],0,strpos($_SERVER['HTTP_HOST'],'.'));
if(!$db_userdomain || in_array($pre_host,array('www','blog','bbs')) || strpos($db_blogurl,$_SERVER['HTTP_HOST'])!==false || gethostbyname($_SERVER['HTTP_HOST'])=='127.0.0.1'){
require_once(R_P.'mod/header_inc.php');
require_once(R_P.'mod/index_inc.php');
} else{
!$db_domain && $db_domain=substr($_SERVER['HTTP_HOST'],strpos($_SERVER['HTTP_HOST'],'.')+1);
$rt=$db->get_one("SELECT uid FROM pw_domain WHERE blogname='$pre_host'");
if($rt['uid']){
if($db_ckdomain==".$db_domain"){
ObHeader("http://$pre_host.$db_domain/blog.php?uid=$rt[uid]");
}else{
ObHeader("$db_blogurl/blog.php?uid=$rt[uid]");
}
} else{
ObHeader("$db_blogurl");
}
}
[/code:1] |
|