_redirects not redirecting


I have launched a new gatsby site and am trying (unsuccessfully) to setup the redirects on Netlify.

https://leeds.independentlife.co.uk is the URL.

The site is a rebuild of an older site, and quite a lot of pages have been removed & link structures have been changed so redirects are essential.

I’m using gatsby-plugin-netlify to generate the _redirects file and everything looks good (files are correctly built), tested in Netlify's playground and all generated redirects are valid. After deploying to Netlify the deploy summary says that all the rules have been processed, but when I test the redirects i’m getting the 404 rather than the specified redirect page.

I have tried with 301, 301!, 404 & 404! but non of these have successfully enforced the redirect when tested in the browser.

Pretty URL’s is active too.

A basic example of what I am trying to achieve…

https://independentlife.co.uk/about-us >> https://independentlife.co.uk/

(the about us page no longer exists as a standalone page and should redirect to the homepage)

The _redirects rule for this is:

/about-us/  /  404!  ignoreCase=false

Might be worth mentioning that i am manually building this locally and manually deploying to Netlify.

Any pointers on why this could be happening/what I’m doing wrong would be massively appreciated.


I don’t think you need to select a specific route, or do you?

You can simply do: /* / 404. This will redirect all 404s to home page. Does this work for your case?

Additionally, it can be worth trying netlify.toml. TOML has a better and clearer syntax that separating stuff with just spaces. It makes it easier to figure out.

Thanks for your reply.

I have tested /* / 404 in _redirects, as well as

from = "/*"
to = "/"
status = 404
force = false

in netlify.toml, but neither are redirecting 404 pages to the homepage successfully

https://independentlife.co.uk/contentdoesnotexists should redirect to https://independentlife.co.uk/ right?! :weary:

From what I can see, your previous rule as well as the TOML file is working fine. But, the problem is with Gatsby. It’s trying to load the page data for the 404 page instead of the home page.

Could you please try 301 once again with the TOML please? Or, if you could share your repo, we can try which one works best for you and suggest that.

Ok so i’ve tried

from = "/about-us/"
to = "/"
status = 301
force = false
conditions = {ignoreCase = "false"}

but am still not getting redirected to the homepage.

The repo is https://bitbucket.org/mikelawton/independent-life-gatsby/src/master/

Thanks again for helping with this. :slight_smile:

You’d probably have to force this rule, however, you can wait till I actually try the repo and comment accordingly.

Hold on. Let me get you a different repo. That one is pretty large and takes a while to build.

Sure, that would be great!

This one should be much less weighty! :weight_lifting_man:


There is a redirect.json file which is used in gatsby-node to loop over all the redirects that I require in the main project. I have kept this simple though and only included one redirect rule.

This one’s asking me to sign in. :slightly_frowning_face:

Apologies! Should be public now

So I tried this with your default config and the problem seems to be with ignoreCase=true that’s getting appended to each rule. If you remove that, the following works: /about-us/ / 404!. Try here: https://hardcore-hugle-7d915f.netlify.app/about-us/

1 Like

Amazing! Will check when I’m back by my computer

Thank you very much for your help - that was the cause and the redirects are now working. :smiley:

1 Like