nginx rewrite WITHOUT change url

后端 未结 2 977
温柔的废话
温柔的废话 2020-12-24 08:09

I want to use rewrite function in my nginx server.

When I try \"http://www.example.com/1234\", I want to rewrite \"http://www.example.com/v.php?id=1234\" and want to

2条回答
  •  孤独总比滥情好
    2020-12-24 08:15

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

提交回复
热议问题