I have found a few different example on the web. The first one I used added a big, long, unnecessary query string to the url. The following one works without a hitch. Just change the .htaccess file in the main folder of your site to one containing this text. Of course, replace yournewdomain.com to the one you are redirecting to.
RewriteRule (.*) http://www.yournewdomain.com/$1 [R=301,L]