Netlify name: trusting-tesla-b1b67c
Domain: Custom domain not controlled by Netlify.
I have connected a sub-domain to netlify and have chosen to not have Netlify control DNS. When the Sub-domain was created Cloudflare auto-generated an SSL. There are currently 2 versions of the site that are live an HTTP and HTTPS (cloud flare). How do I redirect to the HTTPS version via the .toml file? or do I have to re-generate the certificate and install it via Netlifys panel?
:splat is explained in the documentation previously linked.
An asterisk indicates a splat that will match anything that follows it.
With SPAs such as React you need a rewrite as explained here. In a netlify.toml the syntax is
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
This rule must go last (previous rule must go first.)
I believe these two rules together will work as desired in directing all HTTP traffic to HTTPS and allow React to do the routing, however not having a HTTP site to test on, I cannot say for certain.
You would need to create a second rule in addition to the previous.
Example
[[redirects]]
from = "http://example.com/*"
to = "https://example.com/:splat"
status = 301
force = true
[[redirects]]
from = "http://www.example.com/*"
to = "https://example.com/:splat"
status = 301
force = true
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
If you wished to have the www present in the URL the user sees you would change the to value e.g.