Home > Blockchain >  How to redirect traffic from one domain to another (e.g. monkey.com ---> ape.com) in AWS
How to redirect traffic from one domain to another (e.g. monkey.com ---> ape.com) in AWS

Time:02-16

I have looked at documentation on how I can redirect my traffic from one domain to another in AWS but to no avail I am unable to. The way I see the process using AWS is like so:

Route 53 ----> S3 ----> CloudFront ----> ALB ---> CloudFront?

What I have done are the following:

  1. I modified the A record of monkey.com's CloudFront ID 444fasdfdd.cloudfront.net to point to the CloudFront ID 3dfdsafds3.cloudfront.net of ape.com.
  2. I modified the ALB used for monkey.com and created a Listener rule to redirect traffic of www.monkey.com and monkey.com to ape.com
  3. I went to monkey.com's S3 bucket which is using Static Web Hosting and redirected the bucket to go to ape.com.
  4. This is where I am stuck, I do not know what to do on monkey.com's CloudFront Distribution. I want to change the "Alternate Domain Name (CNAME)" of www.monkey.com and monkey.com to www.ape.com and ape.com and replace the Custom SSL certificate of *.monkey.com with *.ape.com; however, I receive an error saying I already have a Distribution of ape.com (which is true).

I hope I made myself clear on the issue I am having. If you want me to clear up any confusion please let me know.

CodePudding user response:

If you edited Route 53 A record for monkey.com to the CloudFront of ape.com, you are using ape.com as the backend, but the URL in the viewer's browser will still show as monkey.com.

Instead, what you need to do is keep Route 53 monkey.com and point it to a dummy website whose only purpose is to return a redirection to the new domain. You can use S3 website for this, or any other web hosting for that matter. Example of using S3 for redirection.

  • Related