A static site has html files in directories per language http://example.com/en For example locations /en/ (english) /es/ (spanish) The static files includes css are directed to the site root, that works, /en/css/style.css -> directed to /css/style.css
location ~ "^/en/(img|js|css)" {
rewrite ^/en(.*)$ $1 last;
}
location ~ "^/es/(img|js|css)" {
rewrite ^/es(.*)$ $1 last;
}
If I now want to add 40 languages, i have to duplicate above location 40 times, How would i make this so that i do not have to duplicate the location for every language code, Is it possible to capture the /two letter lang code/ and reuse it in the rewrite?
Many Thanks!
(?:es|en|fr|ge...)? use OR|so it will match atleast one.