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=1009http://www.xx.com/1.txt 应该怎么做那,感觉应该很简单,但是测试了半天都不行,惭愧!请懂的帮忙说一下 谢谢了

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

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