Follow the instruction carefully
Common Cpanel
1. Login to your cpanel at https://mywebsite.com/cpanel.
2. Select File Manager > Public_html and find the .htaccess file.
3. Find .htaccess file, right-click the .htaccess file, and select edit.
4.Copy and paste the code into the. htaccess file.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^prev-domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.prev-domain.com$
RewriteRule (.*)$ http://www.present-domain.com/$1 [R=301,L]
</IfModule>
1. Replace prev-domain.com and www.prev-domain.com with your previous or old domain.
2. Replace http://www.present-domain.com/ with your official domain name.
Click Save
Try to visit your previous domain if the configuration is successfully effective and it redirects to your official domain name.
-----
Hostinger
1. Login to your hosting account.
2. Select File Manager > Access files of mywebsite.com > Open public_html
RewriteEngine On
RewriteCond %{HTTP_HOST} ^prev-domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.prev-domain.com$
RewriteRule (.*)$ http://www.present-domain.com/$1 [R=301,L]
</IfModule>
1. Replace prev-domain.com and www.prev-domain.com with your previous or old domain.
2. Replace http://www.present-domain.com/ with your official domain name.
Click Save



