简体   繁体   中英

Static website aliasing - doesn't work without www

I set up a static website, with domain name bought from namecheap and hosted using AWS.

I tried following http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html but it's so hard to follow. My website only loads when I put "www" in front of my address. Can someone point me to a easy to follow tutorial or show me how I can correctly handle my aliasing?

Since the name of the S3 bucket has to match the name of the static website it is hosting you will need to create two S3 buckets named domain.com and www.domain.com where "domain.com" is you actual domain name. Configure records for both S3 buckets in Route53.

Next you need to pick which bucket you wish to be your default, and install your static website there. Then you need to setup a redirect rule in the other bucket to redirect to your default bucket. For example if you want the naked domain to be the default then you would setup a redirect rule in your "www" bucket to forward requests to the other bucket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM