How to do location /test/place?id=2

P.V.Anthony anthony at
Thu Oct 17 17:01:25 UTC 2019


Currently have the following url,

Need to redirect only id=2 to another url.

Did the following and it works for id=2. Need id=1 and id=3 to continue 
normally without change.

location = /test/place {
      if ($args = "id=2") {
        return 301$args;

Or is there a way to do the following? That would be ideal.

location = /test/place?id=2 {
     return 301

Unfortunately the above does not work. What is missing?


More information about the nginx mailing list