2016年7月13日 | Leave a comment 问题: 想把 http://a.com/?t1 rewrite 成 http://a.com/?bbb=1 下边代码不行 location ~ ^/\?t1$ { rewrite .... } 123 location ~ ^/\?t1$ { rewrite ....} 解决: 也没有完美解决 location / { if ( $query_string ~ ^t[\d\w_-]+$ ) { return http://kaiweilei.com/?_code=$query_string; } } 12345 location / { if ( $query_string ~ ^t[\d\w_-]+$ ) { return http://kaiweilei.com/?_code=$query_string; } }