How to rewrite location in nginx depending on the client-browser's language?
For example: My browser accept-language is 'uk,ru,en'. When I request location mysite.org nginx must forward to mysite.org/uk
You can manage $language_suffix by this setting when you cannot add AcceptLanguageModule module into your system.
rewrite (.*) $1/$http_accept_language
A more resilient approach would use a map:
map $http_accept_language $lang {
default en;
~es es;
~fr fr;
}
...
rewrite (.*) $1/$lang;