So, you are changing domain names or you want to redirect your old website to your new website?
This is a very simple and common task for .htaccess to handle. Simply open your .htaccess file on your old website and insert the below code:
(Remember to change YourNewWebsite.com to your new website domain.)
RewriteEngine on Redirect 301 / https://www.YourNewWebsite.com/
That's about it!