多中語言實現(xiàn)判斷客戶訪問用得是那個域名 然后轉(zhuǎn)到對應(yīng)的目錄
多中語言實現(xiàn)判斷客戶訪問用得是那個域名 然后轉(zhuǎn)到對應(yīng)的目錄
asp版:
發(fā)表多個綁定多域名的ASP代碼
如果有有一個ASP空間,而你又想放置多個多個站點,這些代碼可以幫到你
第一個
<%if Request.ServerVariables("SERVER_NAME")="bbs.along.com.ru" then
response.redirect "bbs"
else
response.redirect "index1.htm"
end if%>
第二個
<%
select case request.servervariables("http_host")
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")
...... 繼續(xù)添加 ......
end select
%>
第三個
<%if instr(Request.ServerVariables
("SERVER_NAME"),"fjsky.info")>0 then
response.redirect "index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"along.com.ru")>0 then
response.redirect "x/index.asp"
else if instr(Request.ServerVariables
("SERVER_NAME"),"along.net.ru")>0 thenr
esponse.redirect "index3.asp"
end if
end if
end if%>
第四個
<%if Request.ServerVariables("SERVER_NAME")="www.fjsky.info" then
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="fjsky.info" then
response.redirect "main1.asp"
else if Request.ServerVariables("SERVER_NAME")="www.null2.com.ru" then
response.redirect "/web/index.asp"
else if Request.ServerVariables("SERVER_NAME")="null2.com.ru" then
response.redirect "/web/index.asp"
end if
end if
end if
end if%>
第五個
<%
'取得HTTP輸入的值并付值到HTOST中
host=lcase(request.servervariables("HTTP_HOST"))
'開始條件跳轉(zhuǎn)
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
CASE ELSE
response.redirect "web1/"
END SELECT
%>
js版:
<script>
try
{ if( self.location == "http://玉米一/" )
{
top.location.href = "http://玉米一/目錄";
}
else if( self.location == "http://玉米二/" )
{
top.location.href = "http://玉米二/目錄";
}
else if( self.location == "http://玉米三/" )
{
top.location.href = "http://玉米三/目錄";
}
else if( self.location == "http://玉米四/" )
{
top.location.href = "http://玉米四/目錄";
}
else
{ document.write ("錯誤的訪問地址") }
}
catch(e) { }
</script>
case "domain.com":
header("location:blog");
break;
default:
header("location:news");
break;
}
?>
或者
<?php
$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");
}
?>
相關(guān)文章
html工作中表格<tbody>標(biāo)簽的使用技巧
公司大部分的項目都是基于BS結(jié)構(gòu),UI設(shè)計階段做WEB原型頁面時要把各種交互效果實現(xiàn)出來,與真正的后臺編程不同,就用JS前臺編程來實現(xiàn),讓程序員編程前知道要做成什么樣的效果就行了。2008-09-09
解決鼠標(biāo)在 flash 鏈接上不停閃動的問題(web頁面中)
解決鼠標(biāo)在 flash 鏈接上不停閃動的問題(web頁面中)...2006-12-12
從加載到渲染的全鏈路提速的網(wǎng)站打開速度前端優(yōu)化
一個電商網(wǎng)站通過使用ChromeDevTools進行性能診斷,作者發(fā)現(xiàn)并解決了資源加載、圖片優(yōu)化、代碼分割、虛擬列表、狀態(tài)管理以及緩存策略等多個問題,經(jīng)過優(yōu)化,網(wǎng)站的首屏加載時間從8秒降至2秒,多性能指標(biāo)均有顯著提升,和大家分享網(wǎng)站打開速度前端優(yōu)化的實戰(zhàn)經(jīng)驗2024-12-12
HTML5擴展itemscope,?itemtype,?itemprop微數(shù)據(jù)的解釋和應(yīng)用
微數(shù)據(jù)是一種用于在HTML頁面中標(biāo)記內(nèi)容的規(guī)范,以便機器能夠識別和理解特定類型的信息,通過使用特定的標(biāo)簽、屬性和格式,微數(shù)據(jù)的語法包括itemscope、itemprop和itemtype等屬性,可以用來定義和組織數(shù)據(jù)項,微數(shù)據(jù)的廣泛應(yīng)用可以改善搜索結(jié)果的質(zhì)量,為用戶提供更好的瀏覽體驗2024-12-12

