IT & Cloud

AWS S3 Website Redirect Location Not Working

I’m in the process of migrating an old website to S3. The website has been around for over 15 years and some really old links still get inbound traffic. One of the challenges I have is that there are a number of old URLs that I redirected using a .htaccess file that need to continue to be redirected when I migrate to S3.

Before I cut over to AWS permanently, I wanted to test the links to validate the redirects worked as expected. I was using what I thought was the correct S3 Bucket URL and I couldn’t figure out why none of the redirects were working. It was only after I realized that I couldn’t use the S3 object link, I needed to use Website Endpoint URL, not the S3 Link URL.

This is true whether you are testing with routing rules or applying a redirect to a specific object in your bucket.

The below screenshot shows where to find the Website Endpoint URL:


This is not to be confused with the URL path on an individual object like the example below:


Once you’ve got the Website Endpoint URL, you can test redirection of any URL, either by applying a Website Redirect Location to an object or creating a routing rule on the bucket.


CNAME Needs to Point at Endpoint

When you switch your site over to S3 hosting, the CNAME record you configure with your DNS provider also needs to reference the endpoint. Most of the AWS documentation suggests that if you want to properly resolve to the S3 bucket, you need to point the CNAME record for www to What you actually want to do is use the endpoint.

In the example screenshot at the beginning of this article you would point www or whatever your CNAME record is to:


About Jake

Jake blog's many places on a variety of topics, including travel, tech, baseball, and writing. You can read more of his technology articles on Delighted Robot. Jake occasionally posts about great food at Daily Munch.

0 comments on “AWS S3 Website Redirect Location Not Working

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: