Redirection to a custom URL in a SPA

  • Site name: cse-easyword.netlify.app
  • Custom domain: easyword.kr

I have a React SPA, and I want to redirect users from the Netlify subdomain to the custom (primary) domain, using netlify.toml:

[[redirects]]
  from = "/*"
  to = "/"
  status = 200

[[redirects]]
  from = "https://cse-easyword.netlify.app/*"
  to = "https://easyword.kr/:splat"
  status = 301
  force = true

But it does not work. What am I doing wrong here?

You need to put the domain redirect first on the list.

Then you’ll want to change the first (now second) redirect to

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
1 Like