I’ve moved a lot of the sites over years from one domain to another, but I never remembered the htaccess redirect rules to do it. I always needed to search for them, sometimes finding different solutions that were never perfect.
Anyway, here are some of them, in case I need them again. I took them from this site, which has a lot more situations sorted out through redirects.
How do you redirect an entire site or domain to a new one?
Redirect 301 / http://www.domain.com/
How do you use rewriting to redirect from an old domain to a new domain?
RewriteEngine on
RewriteBase /
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]How do you use rewriting to redirect from a non-www to a www subdomain?
RewriteEngine on
RewriteBase /
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
From here: Common Htaccess 301 Redirect Rules.