I'm trying to put together a .htaccess file that redirects:

example.com to subdomain.example.com
www.example.com to subdomain.example.com

It would also redirect any path on example.com or www.example.com to the corresponding path on subdomain.example.com

What's the best way to go about writing this .htaccess file?