Redirect Subdomain of domain1 to subdomain of domain2

For example if we need to redirect x.domain1.com to x.domain2.com [...]