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

2014 年 9 月 15 日
 soho176
6989 次点击
所在节点    NGINX
15 条回复
2232588429
2014 年 9 月 15 日
rewrite没写对?
soho176
2014 年 9 月 15 日
@2232588429 恩 没写对。
soho176
2014 年 9 月 15 日
rewrite ^http://www.xx.com/u/check?u=1009$ http://www.xx.com/1.txt last;

这样写的,但是不行
syncake
2014 年 9 月 15 日
@soho176 打头的^去掉试试
zyxfsky
2014 年 9 月 15 日
^/u/check?u=1009$ 1.txt last;
soho176
2014 年 9 月 15 日
@zyxfsky 还是不行
daemony
2014 年 9 月 15 日
rewrite ^/u/check$ 1.txt last;
soho176
2014 年 9 月 15 日
@daemony 试过了 不行
feiyuanqiu
2014 年 9 月 15 日
^/u/check?u=1009$ /1.txt last;
feiyuanqiu
2014 年 9 月 15 日
记得改了之后要重启服务器
feiyuanqiu
2014 年 9 月 15 日
少写了个 rewrite
rewrite ^/u/check?u=1009$ /1.txt last;
fuxiaopang
2014 年 9 月 15 日
改之后记得 service nginx reload 或者 restart 一下
julyclyde
2014 年 9 月 15 日
rewrite那个包含querystring么?
ryd994
2014 年 9 月 15 日
rewrite ^/u/check\?u=1009 /1.txt break;
ryd994
2014 年 9 月 15 日
另外方便说说你问什么需要这样做么?免得南辕北辙用麻烦的方法解决简单问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.ih06.com/t/133524

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX