Firebase Hosting has a very nice internationalization feature Firebase i18n rewrites
It lets you deploy your angular i18n app, each language is located in its own sub folder. eg: /en /de
When you open your myProject.com Domain, firebase switches, based on your location, language preferences etc to the right language subfolder. This works very good. EG: myProject.com -> myProject.com/en
My question is:
How do i have to configure firebase.json, to also do this, if the user opens a url with a path. EG: if the user opens myproject.com/foo/bar -> it should redirect to myProject.com/de/foo/bar which it does not.
Here is the part of the firebase.json that i am using:
"hosting": {
"public": "www",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"i18n": {
"root": "/"
},
"rewrites": [
{
"source": "**",
"destination": "/en/index.html"
}
]
Under Rewrites i have one rule configured to just switch to the /en version, but i would love to use the same "magic" that firebase provides for the Domain without path. Is there a way without a cloud function?
UPDATE: As requested in the comments, the file structure is
www
/de
/en
There are no files directly in www, just the 2 sub folders for each language. Inside each language folder, there are the typical pwa angular files like index.html, and a bunch of js files.