0

Recently I tried to host my website on Amazon s3 by following steps on http://docs.aws.amazon.com/gettingstarted/latest/swh/getting-started-configure-route53.html ..On Step 5 I created Alias which will route to endpoint. Now, On typing www.example.com it is redirecting to http://example.com.s3-website-ap-southeast-1.amazonaws.com/index.html instead of www.example.com/index.html

How can I route only for example.com instead of endpoint?

2 Answers 2

1

The referenced getting started example how to Associate a Domain Name with Your Website Using Amazon Route 53 is using the increasingly preferred approach to host a website on the domain root, likely because it is slightly more involved and support for this via Route 53 Alias Resource Record Sets being worth mentioning/showcasing.

The Amazon S3 developer guide also features an example for Setting Up a Static Website Using a Custom Domain, which is a bit more explicit about the arbitrary choice which of your two buckets will be the redirection target, see Step 2: Create Two Buckets:

In this example, to support requests from both the root domain such as example.com and subdomain such as www.example.com, you will create two buckets. One bucket will contain the content and you will configure the other bucket to redirect requests. [...] [emphasis mine]

All you need to do is to effectively inverse the configuration instructions for example.com vs. www.example.com (starting from step 2.1.3) to redirect requests from the former root domain bucket to the latter instead of the other way round.

Sign up to request clarification or add additional context in comments.

4 Comments

Do you mean www.example.com should have code and example.com should have redirection?
Yes, if I understood your goal correctly, i.e. you always want your users to end up at www.example.com even if they just enter example.com?!
Well, that is not my goal..For me example.com or www.example.com is redirecting to endpoint like example.com.s3-website-ap-southeast-1.amazonaws.com/index.html instead of just example.com/index.html...Is this expected for redirection to endpoint?
Sorry for my confusion..my bad..it is browser cache redirecting to endpoint Once I cleared my cookies..It is redirecting fine..Thank you for your valuable time..
0

Yout problem appears to be in the prior step.

In the Redirect all requests to box, type the name of your root domain.

The behavior you describe would occur if, instead of just the desired target, "example.com," you entered the entire S3 web endpoint hostname (e.g., example.com.s3-website-ap-southeast-1.amazonaws.com) there.

2 Comments

It is example.com only..It is not endpoint for me in Redirect all requests box
Thanks for your time..It is redirecting fine now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.