By using AWS re:Post, you agree to the Terms of Use

Amplify redirect www to apex


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 they end up in

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
my.tld		NS	[nameservers]
my.tld		SOA	....	CNAME

In the Rewrites and redirects section of Amplify I have:

/<*><*>	200 (Rewrite)
/<*>			/index.html			404 (Rewrite)	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 CNAME to 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.

1 Answer

I'm hosting by blog on Amplify and there are differences to your R53 and rewrite config; I have permanent redirect (301) as the first rule.  https://my.tld 301
/<*>        /index.html    404

And Route53 for www -address is CNAME to applifyapp, not cloudfront.	CNAME	* 

I hope this helps you in getting www->apex rewriting to work.

profile picture
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions