Amazon S3 and .htaccess

Undo picture Undo · Dec 31, 2012 · Viewed 31.8k times · Source

I have a site (Made in iWeb) that I am hosting on Amazon S3. I am trying to get www.domain.com/Apps/Physics.html to turn into www.domain.com/Apps/Physics.

I am trying to accomplish this with an .htaccess file. The file is stored in the root of the bucket (where the index.html file is). Here's the problem: It doesn't work. Still can't use www.domain.com/Apps/Physics.

I have a GoDaddy domain, hosted on the S3 server. Does this help?

Answer

Aniruddh picture Aniruddh · Dec 31, 2012

Why don't you add CNAME record 'static' for domain.com (this one for S3) and host www on a Apache server and a rewrite rule like this:

RewriteEngine On

RewriteRule ^somefolder/(.*)$ http://static.domain.com/$1 [P]

OR

#This will save your time of creating the additional CNAME step    
RewriteEngine On

RewriteRule ^somefolder/(.*)$ http://yourbucket.s3.amazonaws.com/$1 [P]

EDIT: Using mod proxy seems to be a better option.