I have a website on AWS S3 + CloudFront + Route 53.
The CloudFront dist Alternate domain names uses both www.example.com and example.com. also both records are managed with route53 posting to the Cloudfront dist.
I need to server both records, but SEO wise I need redirect the non-www to the www address.
When enabling redirect host in the bucket itself - I get too many redirect errors.
when removing the www. record - its not served on the net.
How can I bypass this using a single S3 bucket for both domains?
Thank you
Related
I’m deploying a SPA in a S3 bucket. I’m using cloudfront to work through https. I need to redirect or delete the www in my domain (example.com). I tried this process:
create a s3 bucket to the www domain (www.example.com) and redirect all requests to the default domain (example.com)
create a distribution for www domain (www.example.com)
create an A type record in Route53 that points to the www distribution
The result is that it’s not redirecting to the non-www bucket. What is happening is that its waiting to find index.html (configured in the default root object) of the www bucket and is thus not redirecting to the other bucket (the non www one)
This is my S3 configuration:
And Cloudfront configuration:
Based on OP's feedback in the comment section, changing the CloudFront origin to use the website endpoint works.
I have hosted a static website on AWS S3 with a custom domain (purchased from crazy domain). I have obtained SSL certificate from AWS ACM.
I need to redirect bare domain "example.com" to "https://www.example.com".
Following are the steps I have followed so far -
Created 2 buckets on S3 - example.com (Used for redirection) and www.example.com (Used for website hosting)
Created 2 cloudfront distribution -
One with "Origin Domain Name" as "example.com.s3.amazonaws.com" and another with another with "Origin Domain Name" as "www.example.com.s3-website-ap-southeast-2.amazonaws.c
om"
Created CNAME record set on crazy domain with WWW pointing to cloudfront distribution as
Added "A" record set in Route53 for both cloudfront distributions.
When I enter example.com in Firefox and Safari, it is redirecting to https://www.example.com but in Chrome it is showing This site can’t be reached
Can anyone please let me know if there is anything specific I need to do for Chrome?
Finally I have figure it out as -
Added NS record set from Route53 to Crazy domain
Removed CNAME record set with www
Added Web Forward record set in crazy domain
I have a domain xxxxx.co.in(brought it through goddady) hosted on AWS S3 as a static web host. Which is only working good when accessing as www.xxxxx.co.in but It is not working with xxxxx.co.in .
I have brought it through goddady.
Add cname record with # and www
and redirect your url xxxx.co.in
I have my-domain.com. I want requests to the www subdomain to redirect to the root, and all requests to redirect to https.
I have 2 S3 buckets - my-domain.com and www.my-domain.com (empty bucket configured to redirect to my-domain.com)
I've set up a Cloudfront distro in front of my-domain.com for https.
For DNS, I have an A record for my-domain.com which is an 'alias' record pointing to the cloudfront distro. I have another A record for www.my-domain.com which is an 'alias' record pointing to the empty www.my-domain.com S3 redirection bucket
This results in the following redirects:
http://my-domain.com -> https://my-domain.com
http://www.my-domain.com -> https://my-domain.com
However a request to https://www.my-domain.com does not redirect. I'm presuming this is because there is no https listener for the S3 redirection bucket. So my question is, is there a better way to do this? I really don't want to have to set up another cloudfront distro just to have this functionality but it feels to me broken if https://www does not redirect correctly.
Thanks in advance,
#rix,
Perhaps this might be what you are looking for. [AWS S3 website+cloudfront root domain redirect issues]
(Cloudfront redirect www to naked domain with ssl)
I know how to redirect/rewrite non-www to www using .htaccess in apache server. But I have no clue, about s3 bucket, and CloudFront. I have hosted the website on an s3 bucket using CloudFront.
How do I redirect all http://example.com/ requests to http://www.example.com
Create a www.example.com S3 bucket and place all the code in this bucket
Create a example.com S3 bucket and set redirect to www.example.com as mentioned in https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/
Create CloudFront and configure with S3 bucket link of www.example.com and add cname entry only for www.example.com.
In Route 53 for www.example.com point alias as CloudFront link related to S3 bucket
In Route 53 for example.com point alias S3 bucket of example.com
There is a feature in S3 where you can to this. Select a bucket, in Properties under Static Web Hosting select Redirect all requests to another host name.
Read more here: https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/
Update from comment:
Add a cname in your domain setup for example.com to point to your bucket endpoint and a cname for your www.example.com to point to the cloudfront endpoint.