How to redirect domain with prefix www in AWS Route 53

旧巷老猫 提交于 2019-12-03 11:13:05

I've gotten this to work using both S3 and CloudFront.

You need two buckets: www.yourdomainname.com and yourdomainname.com.

Keep your files in the www bucket. For the naked domain bucket properties, go to the "Static Website Hosting" section and select "redirect all requests to another host name", and enter www.yourdomainname.com.

This is currently not possible using only Amazon Route 53. Please have a look into this thread for additional information.

Also, please be aware that a "naked domain" (e.g. xyz.com) redirect should be handled in the HTTP layer, not in the DNS.

Following the steps below will resolve your problem:

  1. Create two buckets: one for example.com and one for www.example.com
  2. Setup example.com bucket to redirect to www.example.com
  3. Create two distributions: one using the example.com bucket and one using the www.example.com bucket (Use the corresponding domain for the CNAME)
  4. In route 53, A ALIAS example.com to the first CloudFront distribution and A ALIAS www.example.com to the second CloudFront distribution

After the DNS changes take effect, browse to example.com and it should redirect to www.example.com

I just created two A records that both point the load balancer alias.

cstructor.com A  loadbalancer-url
www.cstructor.com A loadbalancer-url
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!