Amazon Route 53

0

I purchased a domain name via AWS route 53 that is similar to example.co.uk

Is it possible for me to route any traffic from example.co.uk to www.example.co.uk and if so, how do I do so?

Or would I need to purchase the www.example.co.uk url from elsewhere.

2 Answers
1

Yes, you can easily route traffic from example.co.uk to www.example.co.uk using AWS Route 53. You don't need to purchase www.example.co.uk as a separate domain. Instead, you can create a CNAME record for the "www" subdomain that points to example.co.uk.

Here's a step-by-step guide on how to do this:

  1. Log in to your AWS Management Console and navigate to Route 53.
  2. Click on "Hosted zones" in the left navigation pane.
  3. Select the hosted zone associated with your example.co.uk domain.
  4. Click the "Create record" button.
  5. In the "Create record" form, select the "Simple routing" policy.
  6. In the "Record name" field, enter "www" (without quotes).
  7. For the "Record type," choose "CNAME".
  8. In the "Value/Route traffic to" field, enter the domain name you want to redirect to, in this case, "example.co.uk" (without quotes).
  9. Choose a suitable TTL (Time to Live) value. TTL determines how long the record is cached by DNS resolvers. A common value is 300 seconds (5 minutes), but you can choose a different value depending on your needs.
  10. Click the "Create records" button to save the changes.

Now, any traffic going to www.example.co.uk will be redirected to example.co.uk. Keep in mind that DNS changes may take some time to propagate, so it might not work immediately.

If you want to ensure that users always access your website using the "www" version, you can set up a redirect on your web server to redirect traffic from example.co.uk to www.example.co.uk. The process for setting up this redirect will depend on your web server (e.g., Apache, Nginx, etc.) and might require additional configuration.

profile picture
EXPERT
answered a year ago
0

You probably want to to perform a URL redirect from https://example.co.uk to https://www.example.co.uk.

The easiest way to do this in AWS is to use CloudFront. Have a look at this external article, which describes the needed steps.

In your case the CloudFront Function will be a bit simpler though as you don't need a decision built-in. Have a look below at an example:

function handler(event) {
    var newurl = `https://www.example.co.uk`

    var response = {
        statusCode: 301,
        statusDescription: 'Moved Permanently',
        headers:
            { "location": { "value": newurl } }
    }
    return response;
}
profile pictureAWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions