Redirecting an URL to some other is easy if the request comes to your own web server. But when it doesn’t route through your web server, things get a little tricky.

For the worst, what will you do when you have some file in Amazon S3 and a heavy traffic is using that file? For some reasons, you might want to redirect people from S3 to some other website/location (for less cost or something else). How will you do it?

For explaining how to do it lets say that you have a bucket in S3 named testbucket, where you have a file named testfile.jpg. Now when you will try to access this file, you will type following url and get the image in your browser. Lets suppose you want to redirect above url to

For above task following steps are required:

1) Create an html file with any name (say test.html)
2) Write following html code in that:

3) Put this file in S3 testbucket with name testfile.jpg. Make sure your MIME/TYPE is text/html.

Example: Try accessing, you will be redirected to this blog home page.

PS: You may find this link unaccessible coz I might have to delete it for some reasons.

Subscribe - To get an automatic feed of all future posts subscribe here, or to receive them via email go here and enter your email address in the box. You can also like us on facebook and follow me on Twitter @akashag1001.