Stripping out query parameter?

Igor Sysoev is at rambler-co.ru
Tue Mar 3 12:11:09 MSK 2009


On Tue, Mar 03, 2009 at 12:08:11AM -0800, Neil Sheth wrote:

> 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;

-              rewrite ^(.*)$ $1$stripped_params permanent;
+              rewrite ^(.*)$ $1$stripped_params? permanent;

to omit original arguments.

>          }
> 
> Any thoughts?  I'm running 0.6.31.  Thanks!


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list