I'm new to AWS in general, and can't seem to figure out how to redirect my www subdomain to my root domain.
Both my apex domain and www successfully show the website. But I want to redirect www to apex so when users type www.my.tld
they end up in my.ltd
The domain is registered with Google, and set to use the AWS name servers of my hosted zone on Route 53.
The records for my hosted zone are as following:
my.tld A abcdefg99.cloudfront.net.
my.tld NS [nameservers]
my.tld SOA ....
www.my.tld CNAME abcdefg99.cloudfront.net.
In the Rewrites and redirects section of Amplify I have:
/<*> https://abc.cloudfront.net/<*> 200 (Rewrite)
/<*> /index.html 404 (Rewrite)
https://www.my.tld https://my.tld 302 (Redirect - Temporary) RIGHT???
I would expect the above to redirect my www to the apex. But no luck so far.
I also tried changing www.my.tld CNAME abcdefg99.cloudfront.net.
to www.my.tld CNAME my.tld.
but that didn't even resolve the DNS.
Any thoughts on this? Is this even possible with Amplify?
I also stumbled upon this but couldn't apply the solution to my issue.
You can try this: https://docs.aws.amazon.com/amplify/latest/userguide/to-add-a-custom-domain-managed-by-google-domains.html