apache泛域名配置+泛域名指向处理文件

来源:互联网 发布:北京现代软件学院 图片 编辑:程序博客网 时间:2024/04/30 10:00

http://wesoho.blog.51cto.com/715082/224158



# 泛域名解析
<VirtualHost 你的ip:80>
    ServerName *.dswind.com
    ServerAlias *.dswind.com
    DocumentRoot "x:/Fanyuming"
  <Directory "x:/Fanyuming">
 Options FollowSymLinks
 AllowOverride All
 Order allow,deny
 Allow from all
    </Directory>
</VirtualHost>
 
x:/Fanyuming 放一个文件index.php 负责解释泛域名指向
 
<?php
$url_this=$_SERVER ['HTTP_HOST'];
$url_this=str_replace ("www.", "", $url_this);
$url_this=str_replace (".dswind.com", "", $url_this);
$url_this=str_replace ("'", "", $url_this);
$url_this=str_replace ("@", "", $url_this);
$url_this=str_replace ("=", "", $url_this);
$url_this=str_replace (";", "", $url_this);
//固定二级域名优先解析
if($url_this=='2008')
{
header("location:"."http://www.dswind.com/zhuanti/ds13/ ");
}
if($url_this=='2009')
{
header("location:"."http://www.dswind.com/aboutus/yantaohui/");
}
if($url_this=='pku')
{
header("location:"."http://www.dswind.com/zhuanti/yantao/");
}
$dbh = mysql_connect('localhost','用户名','密码');
mysql_select_db('数据库名');
$query = "从数据库查询记录";
$res = mysql_query($query, $dbh);
$err = mysql_error();
if($err){
echo "发生错误,请通知站长";
exit;
}
$row = mysql_fetch_row($res);
if(empty($row[0]))
{
echo "<script>alert('该网址不存在');document.location='http://www.dswind.com'</script>";
exit;
}
else
{ header("location:"."http://www.dswind.com/member/index.php?uid=".$row[0]); }
?>
<html>
<head>
</head>
<body>
 正在进入<a href=http://dswind.com target=_blank>中华直销网</a>直销圈....
</body>
</html>
 

本文出自 “扬帆技术博客” 博客,请务必保留此出处http://wesoho.blog.51cto.com/715082/224158

本文出自 51CTO.COM技术博客






原创粉丝点击