I have a nuxt generate
d JAMStack website with i18n. Generated pages are located in en
and ru
folders. I'm calculating user's locale and serving content from the corresponding folder:
map $http_accept_language $fallback_lang {
~en en;
~ru ru
default en;
}
map $cookie_i18n_redirected $lang {
en en;
ru ru;
default $fallback_lang;
}
server {
location / {
root /var/www/html;
rewrite ^/(.*)/$ /$1 permanent;
try_files /$lang/$uri /$lang/$uri/index.html =404;
}
}
Russian frontpage lies in /ru/index.html
, but English version has no such page and I would like to serve /en/archive/index.html
in response for GET /
if $lang
is 'en'
.
How would I do that?