最简单的一个空间多域名程序
asp:
<%
str=Trim(Request.ServerVariables("SERVER_NAME"))
z=len(str)
q=instr(1,str,".")
h=len(str)+1-instr(5,str,".")
z=z-q-h
dom="/"&mid(str,q+1,z)&"/"
response.redirect dom
%>
---------------------------------------------------------------
php:
<?php
$casevalue=$_SERVER['SERVER_NAME'];
$z=strlen($casevalue);
$q=strpos($casevalue,".",1)+1;
$h=$z-strpos($casevalue,".",5);
$a=$z-$q-$h;
$dom="/".substr($casevalue,$q,$a)."/";
echo header("Location:$dom");
?>
php:
<?php
$casevalue=$_SERVER['SERVER_NAME'];
switch($casevalue)
{
}
?>
echo substr($casevalue,0,$q-1); //获取二级域名
// echo header("Location:$seconddomain"); //跳转到二级域名
// echo header("Location:$dom"); //跳转到二级目录