Redirecting a domain name means pointing one URL to another. The process entails forwarding users who try to load one URL to another of your choice. You can do this in several ways, but the most reliable is through the .htaccess file.
Redirect Domains Using .htaccess
Log in to your web hosting control panel and open the “File Manager” panel. Select your .htaccess file and open it for editing. For domain name redirection, the most typical method is to use a 301 Permanent Redirect.
Add the following code to your .htaccess file:
Redirect 301 / http://domainB.com/
If you do not have an existing .htacces file, create a blank file using the File Editor and enter the code above. Save it with the filename as .htaccess in the root of your public_html directory. If creating this file on your local device, always use a plain text editor such as NotePad.
It is advisable not to use DNS records to redirect URLs since the utility of a CNAME redirect is limited. You will only be able to use CNAME for same-server redirects, while using .htaccess will enable redirects to any URL online.