BioLounge
BioLounge

Reputation: 51

Remove specific query parameters from URL in Nginx

I have a url which is similar to below

http://www.example.com/index.html?jeff=345kol&remove=ab67&test=tester123&ignore=78ujy

I want to remove "&remove" and "&ignore" arguments from the url and after removing its should like as below

http://www.example.com/index.html?jeff=345kol&test=tester123

Is it possible to implement it in Nginx ?

Upvotes: 2

Views: 2675

Answers (1)

Anatoly
Anatoly

Reputation: 15530

Yes, you can use rewrite, each argument is accessible via special attribute, for instance: $arg_jeff, $arg_remove:

location = /index.html {
  rewrite ^ http://www.example.com/index.html$is_args$arg_jeff&arg_test;
}

Upvotes: 1

Related Questions