Remove query string on rewrite

celevra nginx-forum at nginx.us
Thu Aug 12 10:32:56 MSD 2010


Hi,
I am trying to make a 301 redirect like this: 
/authors.php?name=xxx  ==> /author/xxx

this config solves the problem partially - 

        location ~ ^/authors.php {
                 if ($args ~ "name=(.+)" ) {
                           set $arg_name $1;
                          rewrite ^/authors\.php "/author/$arg_name"
permanent;
                }
        }

But the query string remains, and the final location is
/author/xxx?name=xxx

How can i remove the unneeded query string? 

Thank you!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,118933,118933#msg-118933




More information about the nginx mailing list