How to auto redirect Netlify site to HTTPS

Netlify support two ways to config redirect rules for your Netlify site:

  1. Via _redirects file.
  2. 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, the _redirects file should end up in the folder you’re deploying (the Publish directory in your settings)

From Netlify documentation

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.