try_files and GET variables

Reinis Rozitis r at roze.lv
Mon Mar 30 19:14:25 MSD 2009


> The attached patch fixes the bug.

It fixed the garbage part then again QUERY_STRING is now empty at all.. Or is this expected?


In short what I try to archieve is this - if you have:

location /tmp {
    try_files $uri /index.php;
}

And open something like http://myserver/tmp/somecategory/another/?id=234 php still gets 'id' as normal GET variable..



The rewrite or error_page alternative would be:

rewrite  ^/tmp/(.*)$ / last;

location /tmp/ {
        error_page   404 =         /index.php;
}




I somehow see this conflicting if you specify something like this in the config

location /tmp {
    try_files $uri /index.php?q=$request_uri;
}

Then again it gets messy if you want to split the query_string on php side and assign all the variables.. Besides try_files looks 
way more superior than both previous approaches..


wbr
rr 






More information about the nginx mailing list