How can I do the opposite of this?
I want domain dot com to redirect to www dot domain dot com
Make sure the domain you want to redirect from has a proxied A, AAAA, or CNAME DNS record. It could be as simple as a CNAME pointing to the redirect-to domain. Then you can use one of the 2 first examples here: