› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
soho176
V2EX  ›  NGINX

nginx 重定向 http://www.xx.com/u/check?u=1009 到 http://www.xx.com/1.txt 应该怎么做那,感觉应该很简单,但是测试了半天都不行,惭愧!请懂的帮忙说一下 谢谢了

  •  
  •   soho176 · Sep 15, 2014 · 7076 views
    This topic created in 4434 days ago, the information mentioned may be changed or developed.
    2232588429
    2232588429
    Sep 15, 2014
    1
    rewrite没写对?
    soho176
    soho176
    OP
    Sep 15, 2014
    2
    @2232588429 恩 没写对。
    soho176
    soho176
    OP
    Sep 15, 2014
    3
    rewrite ^http://www.xx.com/u/check?u=1009$ http://www.xx.com/1.txt last;

    这样写的,但是不行
    syncake
    syncake
    Sep 15, 2014
    4
    @soho176 打头的^去掉试试
    zyxfsky
    zyxfsky
    Sep 15, 2014
    5
    ^/u/check?u=1009$ 1.txt last;
    soho176
    soho176
    OP
    Sep 15, 2014
    6
    @zyxfsky 还是不行
    daemony
    daemony
    Sep 15, 2014
    7
    rewrite ^/u/check$ 1.txt last;
    soho176
    soho176
    OP
    Sep 15, 2014
    8
    @daemony 试过了 不行
    feiyuanqiu
    feiyuanqiu
    Sep 15, 2014
    9
    ^/u/check?u=1009$ /1.txt last;
    feiyuanqiu
    feiyuanqiu
    Sep 15, 2014
    10
    记得改了之后要重启服务器
    feiyuanqiu
    feiyuanqiu
    Sep 15, 2014
    11
    少写了个 rewrite
    rewrite ^/u/check?u=1009$ /1.txt last;
    fuxiaopang
    fuxiaopang
    Sep 15, 2014
    12
    改之后记得 service nginx reload 或者 restart 一下
    julyclyde
    julyclyde
    Sep 15, 2014
    13
    rewrite那个包含querystring么?
    ryd994
    ryd994
    Sep 15, 2014
    14
    rewrite ^/u/check\?u=1009 /1.txt break;
    ryd994
    ryd994
    Sep 15, 2014
    15
    另外方便说说你问什么需要这样做么?免得南辕北辙用麻烦的方法解决简单问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5215 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 06:22 · PVG 14:22 · LAX 22:22 · JFK 01:22
    ♥ Do have faith in what you're doing.