Running a Hugo-powered site. Multihost with a single instance.
Can’t figure out why these redirects won’t work: netlify.toml in project root has:
[[redirects]]
from = "https://www.site.com/*"
to = "/en/:splat"
status = 200
[[redirects]]
from = "https://www.site.de/*"
to = "/de/:splat"
status = 200
[[redirects]]
from = "https://www.site.fr/*"
to = "/fr/:splat"
status = 200
[[redirects]]
from = "https://www.site.com/posts/*"
to = "/en/posts/"
status = 301
force = true
[[redirects]]
from = "https://www.site.de/posts/*"
to = "/de/posts/"
status = 200
force = true
[[redirects]]
from = "https://www.site.fr/posts/*"
to = "/fr/posts/"
status = 300
force = true
[[redirects]]
from = "https://www.site.com/users/*"
to = "/en/users/"
status = 301
force = true
[[redirects]]
from = "https://www.site.de/users/*"
to = "https://www.site.de/app/#community"
status = 301
force = true
[[redirects]]
from = "https://www.site.fr/users/*"
to = "https://www.site.fr/users/"
status = 301
force = true
https://www.site.com is the main one, but I have independent domains for each language and content directory.
After the project is built, in public folder I get
/en
/de
/fr
and my URLs are without language in the path, just domain
If you want site.fr/news to redirect to site.com/fr/news you would need to do what I previously mentioned e.g.
[[redirects]]
from = "https://www.site.fr/news"
to = "https://www.site.com/fr/news"
status = 301
# you might also need to force the redirect using
force = true
And yes, you can (likely) use a :splat for most things e.g.
[[redirects]]
from = "https://www.site.fr/*"
to = "https://www.site.com/fr/:splat"
status = 301
# you might also need to force the redirect using
force = true
https://www.site.com/posts/* to https://www.site.com/posts/
https://www.site.de/posts/* to https://www.site.de/posts/
https://www.site.fr/posts/* to https://www.site.fr/posts/
https://www.site.com/users/* to https://www.site.com/app/#community
https://www.site.de/users/* to https://www.site.de/app/#community
https://www.site.fr/users/* to https://www.site.fr/app/#community