Using .htaccess to server files from Amazon S3 CloudFront
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.
You could easily fix this with a permanent redirect. But it would completely defeat the purpose of using cloudfront at all.
The idea of cloudfront is that your users always get a fast server close to them. If all the urls still have to go through your server, than you've actually made it slower.
Are you sure you can't just change the links to point to the cloudfront link?
精彩评论