网站隐藏跳转代码php,域名跳转代码[可隐藏与不隐藏域名转向代码(自动跳转代码) ]...
許多域名都綁在上面,而且也就一個(gè)虛擬目錄的話就可以這么做。我開始買服務(wù)器的時(shí)候那IDC商說(shuō)可以綁12個(gè)域名,而且說(shuō)的和租,就以為那多分幾個(gè)目錄沒什么關(guān)系。?但是結(jié)果我注冊(cè)交錢了卻12個(gè)域名只能指向同一個(gè)目錄,無(wú)奈就只有想出這個(gè)鬼方法。?使用方法很簡(jiǎn)單,?比如第一句,的意思就是用戶輸入的是hi1000y.cn,那么就自動(dòng)跳轉(zhuǎn)到http://hi.baidu.com/netfate?,面的意思都是樣的。?SERVER_NAME是輸入的,response.redirect是要跳轉(zhuǎn)到那去的,在根目錄下多建幾個(gè)文件夾,把不同的程序放到不同的目錄。在index做出判斷,然后根據(jù)用戶輸入的域名在跳轉(zhuǎn)到相應(yīng)的目錄,這樣就搞定了。不過(guò)在寫程序的時(shí)候,比如image等等,要把路徑寫全。
方法一:asp
if?Request.ServerVariables("SERVER_NAME")="hi1000y.cn"?then
response.redirect?"http://hi.baidu.com/netfate"
elseif?Request.ServerVariables("SERVER_NAME")="www.hi1000y.cn"?then
response.redirect?"http://hi.baidu.com/netfate"
elseif?Request.ServerVariables("SERVER_NAME")="www.baidu12.com"?then
response.redirect?"http://hi.baidu.com/netfate"
elseif?Request.ServerVariables("SERVER_NAME")="baidu12.com"?then
response.redirect?"http://hi.baidu.com/netfate"
elseif?Request.ServerVariables("SERVER_NAME")="www.baidu12.com"?then
response.redirect?"http://hi.baidu.com/netfate"
elseif?Request.ServerVariables("SERVER_NAME")="baidu12.com"?then
response.redirect?"http://hi.baidu.com/netfate"
elseif?Request.ServerVariables("SERVER_NAME")="baidu12.com"?then
response.redirect?"http://218.61.50.2:60004/"
elseif?Request.ServerVariables("SERVER_NAME")="www.baidu12.com"?then
response.redirect?"http://218.61.50.2:60004/"
elseif?Request.ServerVariables("SERVER_NAME")="baidu12.com"?then
response.redirect?"http://61.176.204.208:60005/"
elseif?Request.ServerVariables("SERVER_NAME")="www.baidu12.com"?then
response.redirect?"http://61.176.204.208:60005/"
else
response.redirect?"http://61.176.204.208:60005/"
end?if
%>
asp版的還有人這么寫:
response.redirect?http://www.baidu12.com/bb0552/
else%>
response.redirect?bb0552/
else%>
response.redirect?bbjyc/
else%>
方法二,htm都可以搞定,這個(gè)比較簡(jiǎn)單
HTML?PUBLIC?"-//W3C//DTD?HTML?3.2//EN">
if(location.hostname=="www.baidu12.com")
location="/bb0552";
if(location.hostname=="www.baidu12.com")
location="/bb0552";
if(location.hostname=="baidu12.com")
location="/bb0552";
if(location.hostname=="www.baidu12.com")
location="/bbjyc";
if(location.hostname=="www.baidu12.com")
location="/bbjyc";
if(location.hostname=="jyclc.cn")
location="/bbjyc";
if(location.hostname=="www.baidu12.com")
location="/txtebook";
if(location.hostname=="fc.baidu12.com")
location="/fc";
if(location.hostname=="baidu12.com")
location="/bb0552";
if(location.hostname=="baidu12.com")
location="/bb0552";
if(location.hostname=="baidu12.com")
location="/bbjyc";
if(location.hostname=="fc.baidu12.com")
location="/fc";
if(location.hostname=="dhzd.baidu12.com")
location="/bbjyc";
if(location.hostname=="jyclc.baidu12.com")
location="/bbjyc";
if(location.hostname=="www.8you.com")
location="/bb0552";
if(location.hostname=="bbs.baidu12.com")
location="/bbs";
if(location.hostname=="bbs.baidu12.com")
location="/bb0552";
if(location.hostname=="")
location="/bb0552";
php的代碼:
switch?($_SERVER["HTTP_HOST"])
{
case?"www.baidu12.com":
header("location:/bb0552");
break;
case?"www.baidu12.com":
header("location:/bbjyc");
break;
case?"www.baidu12.com":
header("location:/txtebook");
break;
case?"fc.baidu12.com":
header("location:/fc");
break;
case?"baidu12.com":
header("location:/bb0552");
break;
case?"baidu12.com":
header("location:/bbjyc");
break;
case?"baidu12.com":
header("location:/bbjyc");
break;
case?"www.baidu12.com":
header("location:/bbjyc");
break;
case?"dhzd.baidu12.com":
header("location:/bbjyc");
break;
case?"www.baidu12.com":
header("location:/bb0552");
break;
case?"baidu12.com":
header("location:/bb552");
break;
case?"":
header("location:/bb552");
break;
}
?>
js跳轉(zhuǎn)。(這樣好象只針對(duì)廢棄的站,然后這樣跳轉(zhuǎn)到新站)
JS跳轉(zhuǎn)到另外一個(gè)米,這樣百度蜘蛛依然爬我原來(lái)的米,而訪客一訪問(wèn)就跳到新米了.
程序代碼
try
{
var?s_domain?=?location.host;
var?js_path?=?"不帶http新米";
if?(s_domain?!=?js_path)
{
var?str=window.location.href;
var?es=/老米不帶www/;
es.exec(str);
var?right=RegExp.rightContext;
top.location.href?=?"http://"+js_path+right;
}
}
catch(e)?{?}
只跳到首頁(yè)就用不著這個(gè)代碼了,呵呵.
訪問(wèn)內(nèi)容頁(yè)的時(shí)候這個(gè)代碼會(huì)自動(dòng)訪問(wèn)新米內(nèi)容頁(yè).
下面百度到的一些好代碼.收藏.
引用內(nèi)容
js提取url參數(shù)的幾種方法。
第一,正則表達(dá)式,直接找出參數(shù)等號(hào)右邊的值即可。但是,如果該參數(shù)后還有&就不可行。
程序代碼
var?str=window.location.href;
var?es=/clid=/;
es.exec(str);
var?right=RegExp.rightContext;
if(right=="1")
{
sub_nav_4.style.display?=?"block";
li4.style.background?=?"#a1ca00";
}
第二,把能找到的參數(shù)都付給argsarr數(shù)組,將來(lái)可以用argsarr[i]進(jìn)行相應(yīng)的訪問(wèn),方法不錯(cuò),太長(zhǎng),參數(shù)不容易記憶。
程序代碼
function?getArgs()
{
//加上substring的意義是去掉查詢字符串中的?號(hào)。
//var?query?=?window.location.search.substring(1);
//定義一個(gè)數(shù)組,用于存放取出來(lái)的字符串參數(shù)。
var?argsArr?=?new?Object();
//獲取URL中的查詢字符串參數(shù)
var?query?=?window.location.search;
query?=?query.substring(1);
//這里的pairs是一個(gè)字符串?dāng)?shù)組
var?pairs?=?query.split("&");//name=myname&password=1234&sex=male&address=nanjing
for(var?i=0;i
{
var?sign?=?pairs[i].indexOf("=");
//如果沒有找到=號(hào),那么就跳過(guò),跳到下一個(gè)字符串(下一個(gè)循環(huán))。
if(sign?==?-1)
{
continue;
}
var?aKey?=?pairs[i].substring(0,sign);
var?aValue?=?pairs[i].substring(sign+1);
argsArr[aKey]?=?aValue;
}
return?argsArr;
}
第三,最簡(jiǎn)單的方法,類似第二種,不過(guò)沒有創(chuàng)建數(shù)組存參數(shù),可直接訪問(wèn)參數(shù)的名字,容易看懂。
程序代碼
function?getarg()
{
var?url?=?unescape(window.location.href);
var?allargs?=?url.split("?")[1];
var?args?=?allargs.split("&");
for(var?i=0;?i
{
var?arg?=?args[i].split("=");
eval_r('this.'+arg[0]+'="'+arg[1]+'";');
}
}
var?urlarg=new?getarg();
if(urlarg.clid=="1")
{
sub_nav_6.style.display?=?"block";
li6.style.background?=?"#a1ca00";
}
js獲取URL地址某個(gè)參數(shù)數(shù)據(jù)
程序代碼
function?closeThis()
{
var?paraName?=?URL_Request("UploadPanelName");
var?cm=window.parent.document.getElementByIdx(paraName);
if?(cm.style.visibility=="visible")
{
cm.style.visibility?=?"hidden";
}
}
function?URL_Request(strName)
{
var?strHref?=?document.location.toString();
var?intPos?=?strHref.indexOf("?");
var?strRight?=?strHref.substr(intPos?+?1);//==========獲取到右邊的參數(shù)部分
var?arrTmp?=?strRight.split("&");//=============以&分割成數(shù)組
for(var?i?=?0;?i?
{
var?dIntPos?=?arrTmp[i].indexOf("=");
var?paraName=?arrTmp[i].substr(0,dIntPos);
var?paraData=?arrTmp[i].substr(dIntPos+1);
if(paraName.toUpperCase()?==?strName.toUpperCase())
{
return?paraData;
}
}
return?"";
}
用js獲取當(dāng)前url地址中的域名
[codevar?getHost?=?function(url)?{
var?host?=?"null";
if(typeof?url?==?"undefined"
||?null?==?url)
url?=?window.location.href;
var?regex?=?/.*\:\/\/([^\/]*).*/;
var?match?=?url.match(regex);
if(typeof?match?!=?"undefined"
&&?null?!=?match)
host?=?match[1];
return?host;
}
alert(getHost());
alert(getHost('https://baidu12.com'));
alert(getHost('http://baidu12.com/123.html'));][/code]
利用JS取得地址欄參數(shù)
程序代碼
假設(shè)URL的地址是?http://localhost/test.html?player=shamohai
var?add?=?top.location;//取得地址欄的URL
add?=?add.toString();
var?showIndex?=?add.indexOf("?player=");//得到參數(shù)的位置
var?showParam="";//需要得到的參數(shù)
if?(playerIndex?!=?-1)?{
showParam=?unescape(add.substring(playerIndex?+?8,?add.length));
}
用JS取得頁(yè)面的參數(shù)
程序代碼
function?QueryString(para)
{
var?retval="",s=location.search.replace("?","");
if(s=="")return?"";s?=?s.split("&");
for(var?i=0;i
if(s[i].toUpperCase().indexOf(para.toUpperCase()?+?"=")==0)
retval+=((retval==""?"":",?")+s[i].substr(s[i].indexOf("=")+1,s[i].length));
return?retval;
} 現(xiàn)在我們開始來(lái)配置ISAPI_Rewrite?:
打開ISAPI_Rewrite的目錄,把httpd.ini的只讀屬性去掉,打開編輯.我們現(xiàn)在是需要把new.asp?id=1234修改成類似new_1234.html的路徑,因此,我們需要在httpd.ini中添加一句
RewriteRule?/new_([0-9,a-z]*).html?/new.asp?id=$1
總結(jié)
以上是生活随笔為你收集整理的网站隐藏跳转代码php,域名跳转代码[可隐藏与不隐藏域名转向代码(自动跳转代码) ]...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 7-15 做梦的wls (20 分)
- 下一篇: RR算法 调度