Something like this:
map $request_uri $requri {
default 1;
/ 0;
}
server {
if ($requri) { return 301 http://example.com$request_uri; } # handle
/xxxxx
location / { # handle / only
[.......]
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,262128,262133#msg-262133