0

I have noticed both google.com and amazon.com, redirect requests to www.google.com and www.amazon.com

I am thinking of doing the same for my website which is hosted on AWS. What is the best approach to do this? I am not sure if it would be better to implement this in Load Balancer or S3? Also is there any downside to always redirecting to www sub-domain?

1 Answers1

1

You can simply create an S3 bucket and configure static web hosting to redirect the requests to www domain.

More details:

Say your main website is www.example.com running on multiple EC2's behind an ALB and you want to set up a 301 redirection for example.com so that when a user visits example.com, he/she will be redirected to www.example.com. You don't need to change anything related to your existing main website domain (www.example.com). The only thing you need to change is to add an S3 bucket and name it example.com, follow the steps to set up redirection, and finally change your DNS.

jellycsc
  • 137
  • 7