Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3 and .htaccess

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?

like image 430
Undo Avatar asked Dec 30 '12 23:12

Undo


1 Answers

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.

like image 155
Aniruddh Avatar answered Oct 05 '22 08:10

Aniruddh