nginx rewrite WITHOUT change url nginx rewrite WITHOUT change url nginx nginx

nginx rewrite WITHOUT change url


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;}


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;}