location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; } }