I want to redirect internet traffic from my root (apex) domain (for instance, example.com) to another domain (for instance, example.net). How can I do this?
Use the following procedure to redirect your domain. In this example, we redirect example.com to example.net.
- A hosted zone for the domain example.com that is hosted in Amazon Route 53.
- You have permissions to add resource records to the hosted zone of example.com.
- You have permissions to create an Amazon Simple Storage Service (Amazon S3) bucket.
- You are able to create an S3 bucket with the exact name for example.com.
Note: The sites must use HTTP, because the redirect can't connect to Amazon S3 over HTTPS.
- In the Amazon S3 console, create an S3 bucket with the exact name as example.com.
Note: S3 bucket names must be globally unique. If the bucket name you need is already in use, you can't use Amazon S3 for redirection. Consider other workarounds such as configuring redirection on your backend server.
- Select the bucket you just created, and then choose Properties. Expand the Static Website Hosting drop-down menu, and then choose Redirect all requests to another host name.
- In the Redirect all requests to another host name field, enter example.net, and then choose Save.
- In the Route 53 console, select the hosted zone named example.com.
- Create a resource record for example.com with the following values:
Record Type: Choose A – IPv4 address.
Alias: Choose Yes.
Alias Target: Select the blank value field, expand the drop-down menu, and then choose your S3 bucket under the heading S3 Website Endpoints.
Routing Policy: Choose Simple.
Evaluate Health Target: Choose No, and then choose Create.
Note: The drop-down menu might take a few moments to populate your bucket name.
You should now be able to redirect example.com to example.net. You can confirm this by browsing to example.com or CURL to example.com. You should see "301 Moved Permanently" in your curl output, redirecting to example.net.