Netlify support two ways to config redirect rules for your Netlify site:
- Via _redirects file.
- Via netlify.toml file.
I prefer the second way because of limitation of the first one.
If you’re running a build command or site generator, theFrom Netlify documentation
_redirectsfile should end up in the folder you’re deploying (the Publish directory in your settings)
Just put below config into your netlify.toml file.
For more information, you can read it from https://www.netlify.com/docs/netlify-toml-reference/#redirects.