If you are using Apache, you can have this information stored directly in the server configuration.
Documentation here: http://httpd.apache.org/docs/current/rewrite/remapping.html
You should be able to use any of the examples above directly in a .htaccess file too if that is your preferred method.
It might be better to implement your redirect in the server configuration if it is a permanent move, however a .htaccess file should be fine.
Edit: I've added code to add to a .htaccess , the first redirects all traffic to the new domain, the second redirects to the new domain whilst maintaining subdirectory paths.
Redirect All:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/ [R=301,L]
Maintain Subdirectory Paths:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]