Redirect rules for Gridsome site processed during build, but not redirecting

Hi!

I’ve tried configuring redirects via both a _redirects and netlify.toml file, but the redirects from /cs/* to /casestudies/:splat don’t appear to be working. For example, https://zero-in.netlify.app/cs/shake-shack/ should be redirecting to https://zero-in.netlify.app/casestudies/shake-shack/.

The _redirects file is appearing in the the root of my dist folder on build and according to the deploy summary the rules are being processed:

Screen Shot 2020-05-02 at 3.30.38 PM

Here are the rules as defined in netlify.toml:

[[redirects]]
 from = "/cs/*"
 to = "/casestudies/:splat"
 status = 301
 force = true

[[redirects]]
 from = "/cs/*/"
 to = "/casestudies/:splat/"
 status = 301
 force = true

And here’s the _redirects config:

/cs/*/ /casestudies/:splat/ 301
/cs/* /casestudies/:splat/ 301
/cs/shake-shack /casestudies/shake-shack 301

Thanks for taking a look!

-Zack

Hello @zacklerner, the redirects do work when you go directly to https://zero-in.netlify.app/cs/shake-shack/. What you are seeing is likely the fact that the redirect doesn’t happen when navigating around in your website/app. I suspect that Gridsome uses clientside routing after the initial page load, which means that there are no requests sent for our servers to redirect. For clientside routing, you’ll need to handle redirects in your code.