How to redirect old domain and all sub pages to new domain using htaccess

If you have an old site and are looking to redirect the entire site to a new URL then simply put this in an .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} old\.com$ RewriteRule .* http://www.new.com/? [L,R=301]