Clean URLs for WordPress on Nginx

location / {
        index index.php ;

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