实现http://a.com/abc得到http://b.com/abc
在server中添加一段代码:
location ^~ /hd { rewrite ^/hd/(.*)$ http://www.google.com/$1 permanent; }实现http://a.com/msg?url=www.b.com得到http://www.b.com
注意问号。
location ^~ /img_proxy { set $img_proxy_url ""; set $suffix ""; if ($query_string ~ "url=(.*)") { set $img_proxy_url $1; set $suffix ""; } resolver 208.67.222.222; proxy_pass http://$img_proxy_url/$suffix; proxy_set_header referer "http://$img_proxy_url"; }