![]() |
多个域名绑定一个空间互不影响php
$domain_net="abc.com";
$dot_net_url="bbs/"; $dot_com_url="flash"; if(($HTTP_HOST=="$domain_net")or($HTTP_HOST=="www.$domain_net")) { Header("Location: $dot_net_url"); } else { Header("Location: $dot_com_url"); } ?> 再如: Quote:
Quote:
Quote:
|
Quote:
|
这是一段很有用的代码,和绑定多域名的ASP代码类似,如果你只有一个PHP空间,而你又想放置多个多个站点,下面这些代码可以帮到你。
第一个: if($HTTP_HOST=="www.0058.net"){ Header("Location: facai.htm"); } elseif($HTTP_HOST=="www.dns.com.cn"){ Header("Location: xinwang.htm"); } else{ Header("Location: other.htm"); } 第二个: if($HTTP_HOST=="www.0058.net"){ require "facai.htm"; } elseif($HTTP_HOST=="www.dns.com.cn"){ require "xinwang.htm"; } else{ require "other.htm"; } |
<?php
$domain_year="bbs.1001year.net"; $domain_cate="1001cate.com"; $domain_pet="1001pet.com"; $domain_1001qb="1001qb.com"; $dot_year_url="year.php"; $dot_cate_url="cate.php"; $dot_pet_url="pet.php"; $dot_1001qb_url="1001qb.php"; if(($HTTP_HOST=="$domain_year")) { Header("Location: $dot_year_url"); } elseif(($HTTP_HOST=="$domain_cate")or($HTTP_HOST=="www.$domain_cate")or($HTTP_HOST=="bbs.$domain_cate")) { Header("Location: $dot_cate_url"); } elseif(($HTTP_HOST=="$domain_pet")or($HTTP_HOST=="www.$domain_pet")or($HTTP_HOST=="bbs.$domain_pet")) { Header("Location: $dot_pet_url"); } else { Header("Location: $dot_1001qb_url"); } ?> |
再写一个好代码,可以试下:
Quote:
|
下面的一段代码也不错的:
Quote:
|
如绑定到一个文件名:
Quote:
|
| All times are GMT +8. The time now is 02:22 PM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.