I am serving static content with Amazon CloudFront and am using my servers as the origin.
Since CF does not respect ? query strings, I can't easily force CF to use new versions of .png files. I also need fast invalidation and do not want to pay for invalidation requests.
So I want to create a completely fake directory with .htaccess to force versioning for my images.
For instance, I want:
domain.com/static/0.12/images/background.png
going to
domain.com/static/images/background.png
Where 0.12 is my APP version, which will be automatically changed through my deployment script.
What would be the .htaccess rule for this?
To force all requests from a URL like
to rewrite to internal URLs like
Use:
If you actually want the URL
to be internally redirected to
Add the following to the .htaccess file in the root of your site.
If the APP version varies then use