Nginx重定向到从查询字符串中提取的URL

时间:2015-11-28 10:54:40

标签: redirect nginx

我正在尝试从查询参数中提取网址,然后使用Nginx重定向到该网址。

例如: http://example.com/redirect/?url=www.google.com

重定向到www.google.com

我已经尝试了返回和重写,到目前为止没有运气。 感谢任何帮助。

location /redirect/ {
        return 301 $arg_url;
        #this one appends example.com with the url. 

}

and ...

location /redirect/ {
        rewrite $arg_url last;
}

0 个答案:

没有答案
相关问题