Home
Support Forums

I'm having trouble setting up a redirect from one domain to another

I have a netlify site at unstarvingartists.org. I recently created a new site at unstarvingartists.com that is also hosted via netlify. I’d like to redirect all paths on the unstarvingartists.org domain as well as the .org apex domain itself to the new unstarvingartists.com.

In my netlify.toml file I have

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

The path redirects are working great. The apex domain redirect is not working. How can I get that to work?

Netlify Site to Redirect: practical-heisenberg-f2399f
Netlify Site to Redirect to: elated-khorana-9abd3a

Thanks for your help!

Per the documentation here Redirect options | Netlify Docs

I added the .org domain as a domain alias to the elated-khorana-9abd3a app. I then added this netlify.toml file to the elated-khorana-9abd3a app.

[[redirects]]
  from = "https://www.unstarvingartists.org"
  to = "https://www.unstarvingartists.com"
  status = 301
  force = false
[[redirects]]
  from = "https://www.unstarvingartists.org/*"
  to = "https://www.unstarvingartists.com"
  status = 301
  force = false
[[redirects]]
  from = "https://unstarvingartists.org"
  to = "https://www.unstarvingartists.com"
  status = 301
  force = false
[[redirects]]
  from = "https://unstarvingartists.org/*"
  to = "https://www.unstarvingartists.com"
  status = 301
  force = false

The path redirect is still working but I can’t get https://www.unstarvingartists.org to redirect to https://www.unstarvingartists.com

Hi @hhw3h

Can you try changing force = true as this will

override any existing content in the path

Also, if you have the same content on both sites, add a :splat e.g.

from = "https://www.unstarvingartists.org/*"
to = "https://www.unstarvingartists.com/:splat"

which would capture https://www.unstarvingartists.org/stories and redirect to https://www.unstarvingartists.com/stories

force=true did it. thanks!

1 Like