An even better solution is:
location / { try_files $uri $uri/ @rewrite; } location @rewrite { rewrite /(../)? /$1index.php?$args; }
because we had some special location rules for catalog|checkout|customer. The problem being that thay all referenced @rewrite - this way we had to rewrite ALL the location commands that were set-up to also have a separate match for /en and later /fr and /de .....
So we came up with the simplest fallback rewrite that test first for / and then for /(two-letter code) .... and rewrites based on that
seems to work fine
In addition the store_code lookup needs to be altered. Because of the /en the http_host variable or server variable do no longer work.
A possible solution can be found here: http://stackoverflow.com/questions/30078679/nginx-conf-w-multiple-maps-to-same-variablehttps://stackoverflow.com/questions/30078679/nginx-conf-w-multiple-maps-to-same-variable