Gatsby Blog in two languages, redirects & two domains

Hello, community,
I’m relatively new to the Netlify game but so far I have to say that I’m very satisfied with it. I also apologize if your question has already been answered and would be happy about a link to the post.
I have the following “problem” and I’ ve created a blog in two languages (German/French). Now I would like to use two different domains for these. I know that I can create domain aliases and redirects but I am not quite sure how to approach this?

The blog is structured so that everything after the / gets to the German site and everything after the /fr/ gets to the French site

I would like to achieve:
german-domain/ => german-domain/
german-domain/fr => french-domain/fr
french-domain/ => french-domain/fr

Country/Language = fr
german-domain/ => french-domain/fr
german-domain/german-legal => french-domain/fr/french-legal

german-domain/randomURL => german-domain/ 
french-domain/randomURL => french-domain/fr/

I hope you understand what I am trying to achieve. Any help is welcome :smiley:

Hey @chrishoste and welcome :slight_smile:
Glad to hear you’re enjoying Netlify so far! You should definitely be able to accomplish what you want with our _redirects file or netlify.toml file:

If you have german-domain pointing to german-blog.netlify.app, your netlify.toml for that site would look something like:

# Regardless of request country, redirect /fr/ to french-domain
[[redirects]]
  from = "/fr/*"
  to = "https://french-domain.com/fr/:splat"
  status = 301
  force = true

# If request country is fr, redirect to french-domain
[[redirects]]
  from = "/"
  to = "https://french-domain.com/fr/"
  status = 301
  force = true
  conditions = {Country = ["fr"]}

Then your french-domain, pointing to french-blog.netlify.app, would have something like this:

[[redirects]]
  from = "/de/*"
  to = "https://german-domain.com/de/:splat"
  status = 301
  force = true

[[redirects]]
  from = "/"
  to = "https://german-domain.com/de/"
  status = 301
  force = true
  conditions = {Country = ["de"]}

You’ll want to play with the asterisks and splats to achieve exactly what you want, but that’s the gist. You may also want to search the forum for “country redirects” to see if others have done something similar before. Let us know if we can answer anything else on this!