Domain redirect in netlify.toml

Hi,

I am trying to redirect from the default Netlify subdomain to my own domain.

This is a Vue.js SPA.

I can get this working when I put the redirect rules in the _redirects file, however, when I move them to the netlify.toml file, it only partially works.

_redirects - Works
https://up-data-viz.netlify.com/* https://up-viz.drewkennelly.co/:splat 301!
/* /index.html 200

netlify.toml - Partially works
If I go to https://up-data-viz.netlify.com/test it will redirect to https://up-viz.drewkennelly.co/test
But if I go to https://up-data-viz.netlify.com, it does not redirect.

[[redirects]]
from = “https://up-data-viz.netlify.com/*
to = “https://up-viz.drewkennelly.co/:splat
status = 301

[[redirects]]
from = “/*”
to = “/index.html”
status = 200

Hi @drewkennelly, you’ll need to add the force=true to your domain redirect. That’s represented by the “!” in the _redirects version of the rule.

Thank you, it is working now.

1 Like