I have a web platform that was build originally on a .co.uk domain. The platform is hosted on nginx ec2 instance. I have now acquired the .com domain for my site and what to fully move over to that domain.
I have essentially replicated my current instance and pointed the .com at the new instance so both work fine in parallel at the moment.
However my Google search adds is all set up with the .co.uk domain and I need to change that using googles domain change tool. They say I should add 301 redirected to the new domain however I am struggling to fine any information on how to do this on AWS from 1 domain/ instance to another.
So I am wondering how I can do a 301 redirect from the old home page to the new domain? Is it possible to do via route 53?
I am wondering if it as simple as just this:
<?php
header("Location: https://www.newdomain.com/", true, 301);
exit();
?>
Thanks