It took me some time to figure out how to do a simple redirect from an old domain to a new domain.
Eventually I managed to do it, but I want to share what happened and see if there’s room to improve the redir doc page.
Objective: I don’t care about preserving URIs, I just want that when you visit any domain1.com URI you are redirected to domain2.com.
Here’s what I tried first:
domain1.com {
redir https://domain2.com 301
}
It didn’t work. Then I read that 301 is the default status code, so I simplified it to:
domain1.com {
redir https://domain2.com
}
This did work. Why?
BTW, the doc is not clear whether we should use 301 or [301]. In my first example I tried both but did not help.