301 redirect to a new domain

hello
Iam trying to do a 301 redirection on my Netlify site, for the Google search console .

This is my file at the root :

_redirects

[[redirects]]
  
    https://lucaslacroix.netlify.app         https://lucaslacroix.com              301

but it’s working

What i supose to do ?

1 Like

You’ve mixed up the syntax for netlify.toml and _redirects.

For _redirects it should be like:

https://lucaslacroix.netlify.app /* https://www.lucaslacroix.com/:splat 301!

For netlify.toml, it should be like:

[[redirects]]
  from = "https://lucaslacroix.netlify.app/*"
  to = "https://www.lucaslacroix.com/:splat"
  status = 301
  force = true
3 Likes