Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|improve this question

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

This question came from our site for 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

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

Your Answer


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