Need help with rewrite

hello,

I need url

domain.com/en/forum/?a=1&a=2&lang=ru

to be rewrited to

domain.com/ru/forum/?a=1&a=2

I ended up with

if ($args ~* “lang=(en|lt|ru|de)(.)")
{
rewrite "^/.{2}(.
)$” /$arg_lang/$1? redirect;
}

but the GET variable “lang” is causing infinite loop - how to unset
the “lang” in nginx?