Stripping out query parameter?

Neil Sheth nsheth at gmail.com
Tue Mar 3 11:08:11 MSK 2009


Hello,

I'm trying to rewrite some urls that are incorrect.  An example would be:

www.mysite.com/test.php?x=123&extra=yes

I want to rewrite this to

www.mysite.com/test.php?x=123

I'm trying something like the following, without luck:

         if ($args ~* ^(.*)(&?)extra=yes$) {
             set $stripped_params = $1;
             rewrite ^(.*)$ $1$stripped_params permanent;
         }

Any thoughts?  I'm running 0.6.31.  Thanks!





More information about the nginx mailing list