网站隐藏跳转代码php,域名跳转代码[可隐藏与不隐藏域名转向代码(自动跳转代码) ]...
許多域名都綁在上面,而且也就一個虛擬目錄的話就可以這么做。我開始買服務器的時候那IDC商說可以綁12個域名,而且說的和租,就以為那多分幾個目錄沒什么關系。?但是結果我注冊交錢了卻12個域名只能指向同一個目錄,無奈就只有想出這個鬼方法。?使用方法很簡單,?比如第一句,的意思就是用戶輸入的是hi1000y.cn,那么就自動跳轉到http://hi.baidu.com/netfate?,面的意思都是樣的。?SERVER_NAME是輸入的,response.redirect是要跳轉到那去的,在根目錄下多建幾個文件夾,把不同的程序放到不同的目錄。在index做出判斷,然后根據(jù)用戶輸入的域名在跳轉到相應的目錄,這樣就搞定了。不過在寫程序的時候,比如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都可以搞定,這個比較簡單
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跳轉。(這樣好象只針對廢棄的站,然后這樣跳轉到新站)
JS跳轉到另外一個米,這樣百度蜘蛛依然爬我原來的米,而訪客一訪問就跳到新米了.
程序代碼
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)?{?}
只跳到首頁就用不著這個代碼了,呵呵.
訪問內(nèi)容頁的時候這個代碼會自動訪問新米內(nèi)容頁.
下面百度到的一些好代碼.收藏.
引用內(nèi)容
js提取url參數(shù)的幾種方法。
第一,正則表達式,直接找出參數(shù)等號右邊的值即可。但是,如果該參數(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ù)組,將來可以用argsarr[i]進行相應的訪問,方法不錯,太長,參數(shù)不容易記憶。
程序代碼
function?getArgs()
{
//加上substring的意義是去掉查詢字符串中的?號。
//var?query?=?window.location.search.substring(1);
//定義一個數(shù)組,用于存放取出來的字符串參數(shù)。
var?argsArr?=?new?Object();
//獲取URL中的查詢字符串參數(shù)
var?query?=?window.location.search;
query?=?query.substring(1);
//這里的pairs是一個字符串數(shù)組
var?pairs?=?query.split("&");//name=myname&password=1234&sex=male&address=nanjing
for(var?i=0;i
{
var?sign?=?pairs[i].indexOf("=");
//如果沒有找到=號,那么就跳過,跳到下一個字符串(下一個循環(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;
}
第三,最簡單的方法,類似第二種,不過沒有創(chuàng)建數(shù)組存參數(shù),可直接訪問參數(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地址某個參數(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獲取當前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ù)
程序代碼
假設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取得頁面的參數(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)在我們開始來配置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
總結
以上是生活随笔為你收集整理的网站隐藏跳转代码php,域名跳转代码[可隐藏与不隐藏域名转向代码(自动跳转代码) ]...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 7-15 做梦的wls (20 分)
- 下一篇: 【PHP】\r \r\n \t是什么