try_files rewrite drops other get variables

Ian Evans ianevans at
Thu Oct 18 02:21:08 UTC 2012

On 17/10/2012 10:03 PM, Edho Arief wrote:
> On Thu, Oct 18, 2012 at 8:59 AM, Edho Arief <edho at> wrote:
>> On Thu, Oct 18, 2012 at 8:55 AM, Ian Evans <ianevans at> wrote:
>>> I thought adding $args to the end of the try_files line would work but that
>>> appeared to mess it up more. Is there any way to get the try_files version
>>> to work like the old version?
>>> Been staring at this but I don't see how
>>> rewrite ^/galleries(/.*$|$) /galleries.php?mypath=$1 last; passes the path
>>> and additional GET variables, but the try_files version doesn't pass on the
>>> additional variables.
>>  From
>> "If a replacement string includes the new request arguments, the
>> previous request arguments are appended after them. If this is
>> undesired, putting a question mark at the end of a replacement string
>> avoids having them appended, for example:"
> Additionally, I do indeed add $args for my try_files for wordpress:
> try_files $uri $uri/ /index.php?q=$uri&$args;

I changed the try_files to:

try_files /pixcache$request_uri/index.html 

and it worked. I had mistakenly added the $args without the '&'

Will take it for a sail and make sure it keeps working. :-)

More information about the nginx mailing list