AI bot can’t even figure it out. Support does not allow me to contact them.
What is the solution?
[[redirects]]
from = "/*"
to = "404.html"
status = 404
[[redirects]]
from = "https://example.com/*"
to = "https://mainwebsite.com/:splat"
status = 301
force = true
[[redirects]]
from = "https://example2.com/*"
to = "https://mainwebsite.com/:splat"
status = 301
force = true
$ curl -I https://example.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 63823 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 200 OK
Accept-Ranges: bytes
Age: 0
Cache-Control: public,max-age=0,must-revalidate
Cache-Status: "Netlify Edge"; fwd=miss
Content-Length: 63823
Content-Type: text/html; charset=UTF-8
...
Domains are setup, SSLs are deployed etc. When visiting the domains I get to the website but example.com does not redirect to mainwebsite.com
That’s not quite true, you can’t use private ‘email support’ but you still have this forum, where the majority of the questions are answered by Netlify Support.
Since you’ve used placeholder domain names example.com, example2.com and mainwebsite.com, I can’t check anything.
Best I can do…
The rules look ok to me
Check your build log, it should say the number of redirect rules it found
Ensure the redirect rules are deployed to example.com and example2.com
To be clear, I don’t work for Netlify, so I’m not going to be doing anything.
The redirect rules absolutely are processed top down, which matches the change you’ve made.
All your rules target the wildcard, but the domain level ones are more specific, so they should go first.
I didn’t mention it when I glanced at it, because I haven’t hosted with Netlify for some time, and never used the status of 404 rule myself.
That said, I’d presumed the 404 rule would have minimal impact due to only applying to paths where the page isn’t found as per the documentation.