# Redirects following architectural changes on the end of October 2018
[[redirects]]
  from="/s%C3%A9curit%C3%A9-sociale"
  to="/g%C3%A9rer"
  status = 301

[[redirects]]
  from="/d%C3%A9marches-embauche"
  to="/g%C3%A9rer/embaucher"
  status = 301

[[redirects]]
  from="/s%C3%A9curit%C3%A9-sociale/s%C3%A9lection-du-r%C3%A9gime"
  to="/simulateurs"
  status = 301

[[redirects]]
  from="/s%C3%A9curit%C3%A9-sociale/*"
  to="/simulateurs/:splat"
  status = 301

[[redirects]]
  from="/entreprise/cr%C3%A9er-une-*"
  to="/cr%C3%A9er/:splat"
  status = 301

[[redirects]]
  from="/entreprise/devenir-*"
  to="/cr%C3%A9er/:splat"
  status = 301

[[redirects]]
  from="/entreprise/*"
  to="/cr%C3%A9er/:splat"
  status = 301

[[redirects]]
  from="/social-security"
  to="/manage"
  status = 301

[[redirects]]
  from="/social-security/assimilated-salaried"
  to="/social-security/assimile-salarie"
  status = 301

[[redirects]]
  from="/social-security/*"
  to="/simulators/:splat"
  status = 301

[[redirects]]
  from="/company/create-a-*"
  to="/create/:splat"
  status = 301

[[redirects]]
  from="/company/become-*"
  to="/create/:splat"
  status = 301

[[redirects]]
  from="/company/*"
  to="/create/:splat"
  status = 301

[[redirects]]
  from="/coronavirus"
  to="/simulateurs/ch%C3%B4mage-partiel"
  status = 301

[[redirects]]
  from="/%C3%A9conomie-collaborative"
  to="/simulateurs/%C3%A9conomie-collaborative"
  status = 301

# SEO redirect
[[redirects]]
  from = "/documentation/contrat-salari%C3%A9/salaire/*"
  to = "/documentation/contrat-salari%C3%A9/r%C3%A9mun%C3%A9ration/:splat"
  status = 301

# InFrance PRODUCTION settings
[[redirects]]
  from = "https://www.mycompanyinfrance.fr/*"
  to = "https://mycompanyinfrance.fr/:splat"
  status = 301

[[redirects]]
  from = "https://www.mycompanyinfrance.com/*"
  to = "https://mycompanyinfrance.fr/:splat"
  status = 301

[[redirects]]
  from = "https://mycompanyinfrance.com/*"
  to = "https://mycompanyinfrance.fr/:splat"
  status = 301

[[redirects]]
  from = "https://mycompanyinfrance.fr/robots.txt"
  to = "/robots.infrance.txt"
  status = 200

[[redirects]]
  from = "https://mycompanyinfrance.fr/sitemap.txt"
  to = "/sitemap.infrance.en.txt"
  status = 200

[[redirects]]
  from = "https://mycompanyinfrance.fr"
  to = "/prerender/infrance/index.html"
  status = 200

[[redirects]]
  from = "https://mycompanyinfrance.fr/social-security/salaried"
  to = "/prerender/infrance/social-security/salaried/index.html"
  status = 200

[[redirects]]
  from = "https://mycompanyinfrance.fr/iframes/simulateur-embauche"
  to = "/prerender/infrance/iframes/simulateur-embauche/index.html"
  status = 200

[[redirects]]
  from = "https://mycompanyinfrance.fr/*"
  to = "/infrance.html"
  status = 200

[[redirects]]
  from = "https://publi.codes/*"
  to = "/publicodes.html"
  status = 200

[[redirects]]
  from = "/*"
  query = {s = "p"}
  to = "/publicodes.html"
  status = 200

# Mon-entreprise.fr PRODUCTION settings
[[redirects]]
  from = "https://mon-entreprise.fr/robots.txt"
  to = "/robots.infrance.txt"
  status = 200

[[redirects]]
  from = "https://mon-entreprise.fr/sitemap.txt"
  to = "/sitemap.infrance.fr.txt"
  status = 200


# Embauche redirection settings
[[redirects]]
  from = "https://embauche.beta.gouv.fr/"
  to = "https://mon-entreprise.fr/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
  status = 301

[[redirects]]
  from = "https://embauche.beta.gouv.fr/simulation"
  to = "https://mon-entreprise.fr/s%C3%A9curit%C3%A9-sociale/salari%C3%A9"
  status = 301

[[redirects]]
  from = "https://embauche.beta.gouv.fr/documentation/*"
  to = "https://mon-entreprise.fr/documentation/:splat"
  status = 301

## Old iframe adresse
[[redirects]]
  from = "https://embauche.beta.gouv.fr/modules/v2/dist/simulateur.js"
  to = "https://mon-entreprise.fr/simulateur-iframe-integration.js"
  status = 301

[[redirects]]
  from = "https://embauche.beta.gouv.fr/dist/simulateur.js"
  to = "https://mon-entreprise.fr/simulateur-iframe-integration.js"
  status = 301

# Redirection pour les pages en anglais
[[redirects]]
  from = "/"
  query = {s = "m"}
  to = "/prerender/infrance/index.html"
  status = 200

[[redirects]]
  from = "/*"
  query = {s = "m"}
  to = "/infrance.html"
  status = 200

# Redirection pour les pages en français
[[redirects]]
  from = "/"
  to = "/prerender/mon-entreprise/index.html"
  status = 200

[[redirects]]
  from = "/cr%C3%A9er"
  to = "/prerender/mon-entreprise/cr%C3%A9er/index.html"
  status = 200

[[redirects]]
  from = "/g%C3%A9rer"
  to = "/prerender/mon-entreprise/g%C3%A9rer/index.html"
  status = 200

[[redirects]]
  from = "/simulateurs/ch%C3%B4mage-partiel"
  to = "/prerender/mon-entreprise/simulateurs/ch%C3%B4mage-partiel/index.html"
  status = 200

[[redirects]]
  from = "/simulateurs/salari%C3%A9"
  to = "/prerender/mon-entreprise/simulateurs/salari%C3%A9/index.html"
  status = 200

[[redirects]]
  from = "/simulateurs/auto-entrepreneur"
  to = "/prerender/mon-entreprise/simulateurs/auto-entrepreneur/index.html"
  status = 200

[[redirects]]
  from = "/simulateurs/ind%C3%A9pendant"
  to = "/prerender/mon-entreprise/simulateurs/ind%C3%A9pendant/index.html"
  status = 200

[[redirects]]
  from = "/simulateurs/assimil%C3%A9-salari%C3%A9"
  to = "/prerender/mon-entreprise/simulateurs/assimil%C3%A9-salari%C3%A9/index.html"
  status = 200

[[redirects]]
  from = "/simulateurs/artiste-auteur"
  to = "/prerender/mon-entreprise/simulateurs/artiste-auteur/index.html"
  status = 200

[[redirects]]
  from = "/iframes/simulateur-embauche"
  to = "/prerender/mon-entreprise/iframes/simulateur-embauche/index.html"
  status = 200

[[redirects]]
  from = "/iframes/simulateur-chomage-partiel"
  to = "/prerender/mon-entreprise/iframes/simulateur-chomage-partiel/index.html"
  status = 200

[[redirects]]
  from = "/*"
  to = "/mon-entreprise.html"
  status = 200

[build]
  # Hack while waiting for netlify to support workspace
  # https://github.com/netlify/build-image/issues/196
  command = "npm i yarn && yarn && yarn workspaces run prepare && yarn workspace mon-entreprise build"
  publish = "mon-entreprise/dist"

[context.deploy-preview.environment]
  EN_SITE = "${path}?s=m"
  FR_SITE = "${path}"

[context.production.environment]
  EN_SITE = "https://mycompanyinfrance.fr${path}"
  FR_SITE = "https://mon-entreprise.fr${path}"

[context."demo".environment]
  EN_SITE = "https://demo.mon-entreprise.fr${path}?s=m"
  FR_SITE = "https://demo.mon-entreprise.fr${path}"