nginx跳转配置如何做到只跳转首页
确保安装nginx时./configure有加入--with-http_perl_module这一项,
然后在nginx.conf配置文件的http{}内、server{}前面加入:(加入内容在结构上与server{}并列)
perl_set$urldecode'sub{my$inf=shift;
my$url=$inf-args;
my$inx=index($url,"redirect=",);
my$redirect="";
if($inx<0){
$redirect=$url;}else{my$red=substr($url,$inx+9,);
my$len=index($red,"\x26",);
if($len<0){
$redirect=substr($red,0,);}else{$redirect=substr($red,0,$len);}}$redirect=~s/\%([A-Fa-f0-9]{2})/pack("C",hex($1))/seg;
return$redirect;}';
在server的location内加入:(加入内容在location之内,location在server之内)
if($arg_redirect){
最后,重新启动nginxPS:以上的$urldecode是变量名,可以更改
本回答由网友推荐
谁给一个直接跳转到指定网页的代码?
有如下多种方法,你自己挑一个喜欢的:
varuserAgent=navigator.userAgent;
varMSIEIndex=userAgent.indexOf("MSIE");
if(userAgent.indexOf("Win")!=-1&&
userAgent.indexOf("MSIE")!=-1&&
userAgent.substring((MSIEIndex+5),(MSIEIndex+8))>=5.5)
window.location.replace("
//-->
没时间转移
有些人想访问网站时,直接进入某个子目录中的文件,如cgi-bin/leoboard.cgi,这时,你只要写一个默认的首页文件如index.htm,内容如下,就可以实现你的要求.
网页跳转
正在进入>>>Loading>>>
正在进入,请等待,谢谢......