Amazon S3 object redirect

Martin picture Martin · Feb 16, 2010 · Viewed 37.2k times · Source

Is it possible to put a redirect header on a s3-object? Like a 301 redirect.

For example:

mybucket.amazon-aws.com/myobject --> example.com/test

Preferably by setting a header like this on the object:

HTTP/1.1 301 Moved Permanently
Location: http://example.com/test
Content-Type: text/html
Content-Length: 0

Answer

Layke picture Layke · Oct 22, 2012

Within the last month, this functionality has just been added.

You can find the API documentation here:

http://docs.amazonwebservices.com/AmazonS3/latest/dev/how-to-page-redirect.html

When you PUT your object, you need to set the x-amz-website-redirect-location key against that object to the 301 redirect that you wish to use.

You can also use the console.

enter image description here