zoukankan      html  css  js  c++  java
  • nginx 配置重定向及nginx配置if

    需求:
    地址
    http://testa/inlinePreview/live.html?id=463738305721405440
    重定向到
    http://testb/shares/live.html?newsId=463738305721405440 break;

    nginx配置:
    在testa的nginx中配置
    if ($request_uri = /inlinePreview/live.html?id=463738305721405440){
      rewrite ^ http://testb/shares/live.html?newsId=463738305721405440 break;
    }
    请求http://testa/inlinePreview/live.html?id=463738305721405440在nginx中$request_uri为去掉http://testa的部分
    即/inlinePreview/live.html?id=463738305721405440

    nginx配置if and方法:
    set $a 0;
    if ($request_uri ~ id=376332472792911872$){ #以id=376332472792911872结尾
      set $a 1;
    }
    if ($request_uri ~ ^/inlinePreview){ #以/inlinePreview开头
      set $a 1$a;
    }
    if ($a = 11 ){
      rewrite ^ http://news.bandaoapp.com/shares/live.html?newsId=376332472792911872 break;
    }

  • 相关阅读:
    web服务器
    javascript对象属性为空的判断
    字符编码:ASCII,Unicode和UTF-8
    javascript 中英文字符长度和截断处理
    函数节流与去抖
    互联网协议
    解读 v8 排序源码
    乱序
    递归
    函数记忆
  • 原文地址:https://www.cnblogs.com/robertsun/p/12994595.html
Copyright © 2011-2022 走看看