Using .htaccess to server files from Amazon S3 CloudFront

Posted by Adrian A. on Stack Overflow See other posts from Stack Overflow or by Adrian A.
Published on 2010-06-18T01:57:06Z Indexed on 2010/06/18 2:03 UTC
Read the original article Hit count: 629

My ideal setup would be to take a current clients site, upload a .htaccess with a regex inside, that would match the URI, and if it finds a certain file extension, it would use the same path, but with an altered domain.

ie.

Normal path:

http://www.domain.com/something/images/someimage.jpeg
http://www.domain.com/assets/js/jquery.js

.htaccess translated would turn the above into:

http://mycdn.other.com/something/images/someimage.jpeg
http://mycdn.other.com/assets/js/jquery.js

I googled this for hours in a row, no luck. Again, this is for actually making use of Amazon's CloudFront. S3 is already mounted to the website for backups and storing files using s3fs, but this doesn't solve the issue since it's using S3 directly, not using the CloudFront.

© Stack Overflow or respective owner

Using .htaccess to server files from Amazon S3 CloudFront

Posted by Adrian A. on Server Fault See other posts from Server Fault or by Adrian A.
Published on 2010-06-18T01:57:54Z Indexed on 2010/06/18 2:03 UTC
Read the original article Hit count: 629

My ideal setup would be to take a current clients site, upload a .htaccess with a regex inside, that would match the URI, and if it finds a certain file extension, it would use the same path, but with an altered domain.

ie.

Normal path:

http://www.domain.com/something/images/someimage.jpeg
http://www.domain.com/assets/js/jquery.js

.htaccess translated would turn the above into:

http://mycdn.other.com/something/images/someimage.jpeg
http://mycdn.other.com/assets/js/jquery.js

I googled this for hours in a row, no luck. Again, this is for actually making use of Amazon's CloudFront. S3 is already mounted to the website for backups and storing files using s3fs, but this doesn't solve the issue since it's using S3 directly, not using the CloudFront.

© Server Fault or respective owner

Related posts about .htaccess

Related posts about amazon-s3