Is there any way to setup redirects without committing a dedicated file to the repository?
I feel like I should keep the app agnostic from its deployment, thus all required information (like api endpoints and such) are injected via env-variables.
What I would like to achieve is to simply redirect from the netlify sub-domain to my main-domain. Even with a netlify.toml this is kinda tricky - at least if youâd like to inject the âfrom-â and âto-urlsâ via env-vars and not hardcode them into the file.
Wouldnât it be sensible to additionally provide an input mask (textarea) in the netlify ui to specify things like redirects? Am I missing something?
In short, it is possible (to redirect to your main domain) but youâre gonna need a redirect, either in the .toml or a _redirects file. The beauty of keeping these out in a file is, with a bit of jiggery-pokery, you can make them context-based. You want certain redirects for prod versus dev? Great! Deploy previews need handling differently? Sorted!
Your rules themselves donât have to be hard-coded. They can be pretty flexible and we allow for things such as splats and query parameters. But, I think you mean âhard-codedâ in relation to the fact that theyâre in a file⌠that said, theyâd be hard-coded in the UI, no?