rewrite rule for nginx

view full story

http://serverfault.com – I'm trying to change my nginx rewrite rule to a try_files but I'm not having any luck. My current config is: if (!-d $request_filename){ set $rule_0 1$rule_0; } if (!-f $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ /index.php?var=$1 last; } I had tried using try_files $uri $uri/ /index.php?var=$uri; in its place but I always recieve an internal server error. Can anyone see what I'm doing wrong here. Thanks (HowTos)