URL rewrite of localisation with nginx I'm having trouble with changing the url of a drupal localisation. All urls are clean, but contain a non-clean localisation part; ?q="language", e.g. ?q=de, ?q=fr.
The site runs on nginx + mysql + php5.

I want to change this to either site.tld/"language"/page or to no url at all, e.g. site.tld/page.

How to change this in the rewrite rules?
This answer should help:
https://serverfault.com/questions/488444/nginx-rewrite-convert-querystring-to-path/488480#488480

I would try something along the lines of:

location @drupal {
  if ($arg_lang) {
    rewrite ^(.*)$ $arg_lang/$1? permanent;
  }

  rewrite ^ /index.php;
}


The above assumes that requests with ?lang=XX do not have any other arguments, and that the request does not already have the language prefix in the page request (ex: /XX/node/123?lang=XX).