Search and replace query string

Chuck Vose vosechu at
Fri Jul 27 02:23:01 MSD 2007

I've been pounding against this for a little while and it's time to
ask for help. I'm not sure if it's possible since google has found no
similar stories but I can hope.

We're trying to take a query string and replace the ?, &, and = with
/. We're going to try to do caching on disk this way. Naturally I
would appreciate advice about whether this is a good idea or not but
that's not the soul of this question.

Here's the code I've tried to create.

if ($query_string ~ ^(s!(\?|&|=)(?:)!/!g)$) {
  set $new_url $1;
  rewrite ^(.*)$ $new_url.html break;

Thank you in advance,
Chuck Vose

More information about the nginx mailing list