成人AV在线无码|婷婷五月激情色,|伊人加勒比二三四区|国产一区激情都市|亚洲AV无码电影|日av韩av无码|天堂在线亚洲Av|无码一区二区影院|成人无码毛片AV|超碰在线看中文字幕

域名跳轉(zhuǎn)280054016

一個空間綁定多個域名實現(xiàn)自動跳轉(zhuǎn)的幾種方法!給出我自己使用的代碼,比如:我有域名1;域名2!我想域名直接訪問blog/index.php域名2只訪問首頁index1.html www.lnicp.co

一個空間綁定多個域名實現(xiàn)自動跳轉(zhuǎn)的幾種方法!

給出我自己使用的代碼,比如:我有域名1;域名2!

我想域名直接訪問blog/index.php

域名2只訪問首頁index1.html www.lnicp.com http://shumaxiangji.38nvxing.com/

跳轉(zhuǎn)頁面

即可實現(xiàn)!

本人只是菜鳥,如果不對之處,請大家口下留情!

第一個

程序代碼

<

if Request.ServerVariables("SERVER_NAME")="www.1xx.com" then

response.redirect "williamlong/index.htm"

else

response.redirect "index2.htm"

end if

>

,

第二個

程序代碼

<

select case request.servervariables("http_host")

case "www.1xx.com" '1

Server.Transfer("v3.htm")

case "www.2xx.com" '2

Server.Transfer("i.htm")

case "www.3xx.com" '3

Server.Transfer("write100.htm")

...... 繼續(xù)添加 ......

end select

>

第三個

程序代碼

<

if instr(Request.ServerVariables("SERVER_NAME"),"www.1xx.com")>0 then response.redirect "index.asp"

elseif instr(Request.ServerVariables("SERVER_NAME"),"www.2xx.com")>0 then response.redirect "x/index.asp"

elseif instr(Request.ServerVariables("SERVER_NAME"),"www.3xx.com")>0 then response.redirect "index3.asp"

end if

>

第四個

程序代碼

,

<

if Request.ServerVariables("SERVER_NAME")="www.1xx.com" then

response.redirect "index1.asp"

elseif Request.ServerVariables("SERVER_NAME")="www.2xx.com" then

response.redirect "index2.asp"

elseif Request.ServerVariables("SERVER_NAME")="www.3xx.com" then

response.redirect "index3.asp"

end if

>

第五個

程序代碼

<

if Request.ServerVariables("SERVER_NAME")="www.1xx.com" then

Server.Transfer("williamlong.htm")

elseif Request.ServerVariables("SERVER_NAME")="www.2xx.com" then

Server.Transfer("moon.htm")

elseif Request.ServerVariables("SERVER_NAME")="www.3xx.com" then

Server.Transfer("write100.htm")

else

Server.Transfer("other.htm")

end if

>

這是一段很有用的代碼,和綁定多域名的ASP 代碼類似,如果你只有一個PHP 空間,而你又想放置多個多個站點,下面這些代碼可以幫到你

第一個:

程序代碼

if($HTTP_HOST=="www.1xx.com"){

Header("Location: moon.htm");

,

}

elseif($HTTP_HOST=="www.2xx.com"){

Header("Location: williamlong.htm");

}

else{

Header("Location: other.htm");

}

第二個:

程序代碼

if($HTTP_HOST=="www.1xx.com"){

require "moon.htm";

}

elseif($HTTP_HOST=="www.2xx.com"){

require "williamlong.htm";

}

else{

require "other.htm";

}

二用JS 來實現(xiàn)多域名的跳轉(zhuǎn)

,

詳解:

1:首先,你的空間必須支持ASP ,并且這個空間可以綁定下面所用到的兩個域名,然后新建一個ASP

的首頁文件,這個ASP 文件中的代碼這么寫:

response.redirect "index.html" ' 將它轉(zhuǎn)發(fā)到相應(yīng)的文件夾 else>

"index.html"

else>

else>

"soft/index.html"

else>

2:寫好后將這個文件存儲為index.asp ,也就是要做你的首頁。不用擔(dān)心,這個是不會顯示的。這

個就是自動識別訪問者輸入域名的,然后依據(jù)訪問者輸入的地址進(jìn)行自動跳轉(zhuǎn)的。跳轉(zhuǎn)是在瞬間完

成的,你是看不到的。呵呵

3. 現(xiàn)在要做的就是把你空間中建立兩個不同的文件夾了,分別做為兩個網(wǎng)站的目錄。比如一

,

個放音

樂的cd 文件夾。一個放FLASH 動畫的flash 夾件夾。里面的內(nèi)容自己放!

4. 開始上傳剛才做的index.asp 文件吧!把index.asp 文件上傳到空間根目錄下。

5. 去你的空間中將兩個域名都進(jìn)行綁定好,然后就可以測試了。

標(biāo)簽: