Redirect doesn't seem to be redirecting

Hey there,

I’m having some trouble getting a redirect to work, so I have a SPA which connects to an api on a different domain, I would like to redirect requests from /api/ to the api domain

The SPA is on:

The API is on:

I’ve read the docs about redirects and added the following to my _redirects file:

/* /index.html 200
/api/* 200

On my deploy page it is showing that these redirect rules have been processed, but I am still getting a 404 on the requests and they still appear to be directing to /api/ (ie. MoDeck)


It seems like it’s not implementing the redirect? Is there something I’m missing here?

Any assistance would be much appreciated!


You might need to update your rule with a bang (or force) or, simply, a !, e.g.

/api/* 200!

I think I just figured it out now, I’ve swopped the order of that first and second redirect and it seems to be working!
I’m guessing it is to do with the order in which in implements the redirects

1 Like

Dang, yeah, you want the less specific rules at the bottom. I even wrote the guide on that (see Order of execution). D’oh.

Nice one!

1 Like