Rewriting using query args?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Tue Nov 6 20:44:55 MSK 2007


Marcin Kasperski <Marcin.Kasperski at softax.com.pl> writes:

> Is it possible to rewrite url using query args? I mean rewriting sth
> like
>       /get_file?file=bleh.zip
> to
>       /download/bleh.zip

I asked stupid question so I will answer it myself.

Sth like

        if ( $args ~ file=(.*)\.zip ) {
           set $file $1;
           rewrite ^/get_file /download/$1 redirect;
           break;
        }






More information about the nginx mailing list