How can I achieve the following? I want to redirect all non-file requests to a script, like this: if ($request_uri !~* (js|css|images|etc)$) { rewrite ^/(.+)$ /index.php?q=$1 last; break; } ...but this does not work. I do not want to use "if (!-f $request_filename)" to avoid disk overhead. Can anyone make a suggestion? Thanks!