Netlify.app and netlify.com subdomains are showing in Google search results

Hi, @anon6271552, this all looks correct. The only change I would make is to force the 301 redirect by using 301! in place of just 301.

Yes, I would recommend two rules, one for both HTTP and HTTPS, so this (which also includes the 301! change):

https://example.netlify.app https://example.com 301!
http://example.netlify.app  https://example.com 301!

(All sites are HTTPS at Netlify so this is why both HTTP and HTTPS redirect to HTTPS above.)

Finally, yes, you can do netlify.toml and/or _redirects. I prefer the _redirects file as the syntax is simpler but that is only my personal preference. You can use either one (or even both at the same time with some rules in netlify.toml and other rules in _redirects).

Again though, I would personally just stick with _redirects and the 301! rules above.

If there are other questions, please reply anytime.