Hi folks, our first post on here!
Would really appreciate any help with a redirect problem we’ve been having - have searched in this tag but not turned up anything that’s helped so far.
We have a site up and running on a custom domain at https://musafespace.org.uk (we haven’t launched the site yet so please don’t put it around), and the same site served with a .co.uk TLD as well. We sorted that out ages ago, so we’re not waiting on DNS propagation or anything.
In addition to the usual 404 handling (i.e. redirecting to home) we want any traffic to the Netlify subdomain or to .co.uk to be forcibly 301 redirected to the .org.uk address, and have followed Netlify’s (excellent) relevant docs to the letter, as far as we can tell.
So we have the appropriate rules in the netlify.toml
file at the root of the project. For example, the first two read:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[[redirects]]
from = "https://www.musafespace.co.uk/*"
to = "https://www.musafespace.org.uk/:splat"
status = 301
force = true
And we have the same rules in a _redirects_
file which ends up in the build
folder (we’re running React). According to Netlify this should take priority, but since they’re the same rules it shouldn’t matter either way. The full set looks like this:
/* /index.html 200
https://www.musafespace.co.uk/* https://www.musafespace.org.uk/:splat 301!
https://musafespace.co.uk/* https://www.musafespace.org.uk/:splat 301!
https://www.musafespace.netlify.com/* https://www.musafespace.org.uk/:splat 301!
https://www.musafespace.netlify.app/* https://www.musafespace.org.uk/:splat 301!
NB. The last line is to account for Netlify’s move to .app sometime this month, as per recent emails.
However, none of these redirects are working!
The logs for our most recent master deploy are here.
These confirm that 10 redirect rules are being properly processed i.e. all 5 in both the netlify.toml
and _redirects
files.
Any leads on this much appreciated! Thanks