How could I permanently redirect dynamic url with querystrings?

Gena Makhomed gmm at
Sun Jun 20 16:39:20 MSD 2010

On 20.06.2010 14:06, WisdomFusion wrote:

>> - rewrite ^.*$$tid-1-1.html permanent;
>> + rewrite ^$tid-1-1.html? permanent;

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

> Thanks. ^^
> It works perfect. Thanks a lot.
> By the way, I always refers to configuration from
>, but it's so brief that
> some details like this problem I encountered are not included. Where
> could I find more detailed reference materials?

high quality English documentation can be located
at official nginx site:

information about "question mark as the last character"
present at

If in the line of replacement arguments are indicated, then the rest of 
the request arguments are appended to them. To avoid having them 
appended, place a question mark as the last character:

   rewrite  ^/users/(.*)$  /show?user=$1?  last;

'^' character is pcre regexp, it means 'start of string',
more detailed manual about Perl Compatible Regular Expressions
syntax is

$request_uri - internal nginx variable,
it described at


quite often English documentation at
are more detailed than russian
(wiki describes many undocumented nginx options and features)

but Russian documentation at
always more accurate and correct than information at wiki,
because Russian documentation maintained in sync
with main development branch by creator of nginx.

it can be readed in english via Google Translate.

Best regards,

More information about the nginx mailing list