How do I write a subdomain redirect?

Found answer here, first result by searching redirect to different domain apache htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^example.au$ [OR]
  RewriteCond %{HTTP_HOST} ^www.example.au$
  RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]
</IfModule>

It doesn’t matter if just your TLD is different the same format will work