https://stackoverflow.com/questions/...ge-domain-name

When moving a domain name to a new domain where the only change to the url is the domain name, I use the following redirect in my Apache .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^(.*)$ https://newdomain.com$1 [R=301,L]