Say I have a blog at /blog
. I would like any non-existent links, like say blog/doesnt-exist
to redirect back to /blog
rather than go to my 404 page.
I thought I could accomplish this by setting /blog/* /blog 301
but I still get a 404 if I try a non-existent link. I’ve tried 301!, 404, 200 and not achieving the desired results.
I know that if I explicitly write out rules for each route, like /blog/no-exist /blog 301
then it will work fine. But that would be cumbersome and not a “catch-all” solution.
How would I go about setting up a bucket to redirect ALL incorrect/non-existent links at a particular route to another route, rather than a 404.
For context, this is a Gatsby project that is already deployed to Netlify, where I have a _redirects
file with other working redirect rules.