Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Is it possible to use mod_rewrite on Amazon S3?

www.example.com/about.html -> mybucket.s3.amazon.com/index.html
www.example.com/welcome.html -> mybucket.s3.amazon.com/index.html
www.example.com/contact.html -> mybucket.s3.amazon.com/index.html

Thanks!

share|improve this question

migrated from serverfault.com Feb 21 '11 at 21:40

This question came from our site for professional system and network administrators.

    
How come you haven't just got a CNAME pointing at your S3 bucket? –  Piers Karsenbarg Feb 22 '11 at 17:08
add comment

1 Answer

The examples you shared here don't require rewriterules on amazon s3 itself, the redirections all happen on the www.example.com site: so either in .htaccess or vhost conf or httpd.conf:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/(about|welcome|contact)\.html$ http://mybucket.s3.amazon.com/index.html [R,L]

Granted, this will change the URL shown in the browser. If you want to do this without it being so apparent to the end user, then as @piers says, you will need to add a cname for your bucket on s3. and then reference/link to these files at your new http://mybucketalias.example.com/index.html address.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.