Using different redirects across different contexts/environments

Hi @dvasdekis,

We have an open feature request to support putting redirects in deploy context, I’ve added your voice to this request so we’ll let you know once it’s been added.

What most people do in this situation is to write a script, could be in any language or just do it in bash. This script checks the BRANCH or CONTEXT and depending on what is there, it renames a file. This way you prepare multiple _redirects files with different names, and rename the one you want to be active to _redirects. You can also dynamically generate a _redirects file inside of a script during your build process if you prefer doing it that way.

4 Likes