Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3 object redirect

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 
like image 958
Martin Avatar asked Feb 16 '10 12:02

Martin


People also ask

What is a 301 redirect and how do I do it?

A 301 signals a permanent redirect from one URL to another, meaning all users that request an old URL will be automatically sent to a new URL. A 301 redirect passes all ranking power from the old URL to the new URL, and is most commonly used when a page has been permanently moved or removed from a website.

How do I mask my Amazon S3 URL?

There are two parts to masking your S3 url, the first is creating and naming a bucket in S3 to match the subdomain, the second is creating the subdomain and pointing it to the S3 bucket url.


1 Answers

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

like image 194
Layke Avatar answered Sep 27 '22 15:09

Layke