Guide: Domain Redirection with S3 and Route 53
This guide summarizes how to set up a serverless domain redirect using Amazon S3 and Amazon Route 53. We will cover the specific method outlined in the Tutorials Dojo article, which uses an HTML file, and also present a more direct, recommended alternative using S3's built-in redirect feature.
This is commonly used to redirect traffic from a www
subdomain to your main domain (e.g., www.example.com
-> example.com
) or to redirect an old domain to a new one.
Method 1: The HTML Meta Refresh (As Described in the Tutorial)
This method works by placing an HTML file in an S3 bucket that tells the user's browser to redirect to a different page. This is a client-side redirect.
Step 1: Create the index.html
Redirect File
-
Create a new file on your local computer named
index.html
. -
Paste the following HTML code into the file.
-
Crucially, replace
https://www.your-destination-domain.com
with the full URL you want to redirect users to.