多中語言實作判斷客戶存取用得是那個網域 然後轉到對應的目錄
asp版:
發表多個綁定多網域的ASP代碼
如果有有一個ASP空間,而你又想放置多個多個站點,這些程式碼可以幫到你
第一個
response.redirect "bbs"
else
response.redirect "index1.htm"
end if%>
第二個
case "www.along.com.ru" '1
Server.Transfer("along.htm")
case "www.along.net .ru" '2
Server.Transfer("net.htm")
case "www.null.com.ru" '3
Server.Transfer("null.htm")
. ..... 繼續增加 ......
end select
%>
第三個
("SERVER_NAME" ),"fjsky.info")>0 then
response.redirect "index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"along.com.ru")))php 沒有
response.redirect "x/index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"along.net.ru")>0 thenr
esponse.redirect "index33 .asp"
end if
end if
end if%>
第四個
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="fjsky.info" then
response.redirect "main1.asp"
elsequest .ServerVariables("SERVER_NAME")="www.null2.com.ru" then
response.redirect "/web/index.asp"
else if Request.ServerVariables("SERVER_NAME")="nse if Request.ServerVariables("SERVER_NAME")="nullull2.com .ru" then
response.redirect "/web/index.asp"
end if
end if
end if
end if%>
第五個'取得HTTP輸入的值並支付值至HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
'開始條件跳轉
SELECT CASE host ' 如果HOST的值是www.iswind.net就選擇事件case"www.iswind.net"的指令
CASE "www.abc.net"
' Below is the redirect command
response .redirect "web/"
CASE "www.efd.com"
response.redirect "web1/"
'We use CASE ELSE to fix any other requests
CAScom redirect "web1/"
END SELECT
%>
js版:
<script> <br>try <br>{ if( self.location == "http://玉米一劑/" ) <br>{ <br>top.location.href = "http://玉米一/目錄"; <br>} <br>else if( self.location == "http://玉米二/" ) <br>{ <br>top.location.href = "http://玉米二/目錄"; <br>} <br>else if( self.location == "http://玉米三/" ) <br>{ <br>top.location.href = "http://玉米三/目錄"; <br>} <br>else if( self.location = = "http://玉米四/" ) <br>{ <br>top.location.href = "http://玉米四/目錄"; <br>} <br>else <br>{ document.write ("錯誤的存取位址") } <br>} <br>catch(e) { } <br></script>
case "domain.com":
header("location:blog");
break;
default:
header("location:news");
break;
}
?>
或
$domain_net="yeahe.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");
}
?>