Search and replace query string

Chuck Vose vosechu at gmail.com
Tue Aug 7 21:31:26 MSD 2007


> No, nginx does not allow "s///". Currently the only way to do it
> inside nginx is ngx_http_perl_module variable:
>
> http {
>
>      perl_set  $new_url  'sub {
>           my $r = shift;
>           my $a = $r->args;
>           $a =~ s/(&|=)/\//g;
>           return $a;
>      }';
>
>      server {
>
>          location / {
>               rewrite  ^(.+)$  $1$new_url.html  break;
>               ...
>          }

Thank you very much! Works like a charm and i never would have figured
that out without you :)

-Chuck Vose





More information about the nginx mailing list