Using .htaccess to server files from Amazon S3 CloudFront
- by Adrian A.
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.