i'm having trouble for my config here is how i want to work mydomain.com -> redirect to correct language : mydomain.com/en/ or mydomain.com/fr/
I have two angular build with i18n, one for each language. the redirection with language works, but direct links with angular 2 not : if i go to mydomain.com/fr/connect -> 404
Here is my nginx configuration
map $http_accept_language $lang {
default en;
~*^fr fr;
}
server {
listen 80;
server_name domain.com www.domain.com;
root /usr/share/nginx/html;
index index.html index.htm;
location = / {
rewrite "^.$" /$lang/ break;
}
location = /$lang/ {
try_files $uri $uri/ /index.html;
}
}
if some of you know this, i'm just stuck there, i'm a nginx begginner :/
yourapp/fr/connectis not an actual route like you are used to with, for instance, PHP servers. It's actually a way for Angular to fetch the corresponding templates. So you won't have access to it by typing the url. I use the hashLocationStrategy as a workaround :RouterModule.forRoot(appRoutes, { useHash: true })