Problems with site url redirects

Hello,

I’m trying to redirect traffic from site1 ‘https://alvarosaburido.com/’ to my new domain ‘https://alvarosaburido.dev’ site2 (both are registered externally but using Netlify DNS)

I added the following code to netlify.toml file after checking Redirects and rewrites | Netlify Docs and Redirects and rewrites | Netlify Docs

[build]
  command = "npm run build:lazyload && npm run export"
  publish = "dist"
[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
[[redirects]]
  from = "https://alvarosaburido.com"
  to = "https://alvarosaburido.dev"
  status = 301
  force = true  

After deploying successfully, if I go to alvarosaburido.com it doesn’t seem to redirect.

It’s possible to do? I guess I did something wrong, but can’t tell what could be. Also not an expert on redirects, first-time I’m trying to configure this.

Thanks in advance

@alvaro.saburido You have to remember that redirect instructions are processed in the order they appear, so I’m guessing that your first instruction is executing and visitors to your .com URL are never seeing the second redirect instruction.

Thaaank you. It was exactly just that, the order, I notice it only work for the home url, is it possible to add a token so every page under the domain also get redirected? example alvarosaburido.com/blog to alvarosaburido.dev/blog ?

@alvaro.saburido Are you doing this piecemeal, or do you want everything to redirect? If you want everything to redirect, you can do this in your Netlify DNS dashboard, or in a redirect with something like:

[[redirects]]
  from = "https://alvarosaburido.com/*"
  to = "https://alvarosaburido.dev/:splat"
  status = 301
  force = true  
1 Like

OMG it worked! Thank you very much for the support!