nginx rewrite WITHOUT change url

In my case, I needed to use 'last' to make it work due I had other rules that I wanted to be applied:

location ~ /[0-9]+ {
    rewrite "/([0-9]+)" /v.php?id=$1 last;
}

Reference: http://wiki.nginx.org/HttpRewriteModule#rewrite

If the replacement string begins with http:// then the client will be redirected, and any further >rewrite directives are terminated.

So remove the http:// part and it should work:

location ~ /[0-9]+ {
        rewrite "/([0-9]+)" /v.php?id=$1 break;
}

Tags:

Nginx

Rewrite