hankknight
asked on
Apache: Cache based of query
I want to cache static files based on the request query.
For example:
http://www.example.com/image.jpg?CacheTime=day
http://www.example.com/image.jpg?CacheTime=week
http://www.example.com/image.jpg?CacheTime=year
Is there any way to do something like this?
For example:
http://www.example.com/image.jpg?CacheTime=day
http://www.example.com/image.jpg?CacheTime=week
http://www.example.com/image.jpg?CacheTime=year
Is there any way to do something like this?
<QueryMatch CacheTime=day>
Header unset Pragma
ExpiresActive Off
Header unset ETag
Header unset Last-Modified
Header set Cache-Control "max-age=86400, public"
</FilesMatch>
<QueryMatch CacheTime=day>
Header unset Pragma
ExpiresActive Off
Header unset ETag
Header unset Last-Modified
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<QueryMatch CacheTime=year>
Header unset Pragma
ExpiresActive Off
Header unset ETag
Header unset Last-Modified
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
I think maybe this is what you want: http://tutorialpedia.org/tutorials/Apache+enable+file+caching+with+htaccess.html Your code above doesn't identify what is to have it's cache settings altered.
ASKER
I want this to be cached for one day:
http://www.example.com/image.jpg?CacheTime=day
I want this to be cached for one week:
http://www.example.com/image.jpg?CacheTime=week
I want this to be cached for one year:
http://www.example.com/image.jpg?CacheTime=year
These links all have the same file path, filename and extension. The only thing that is different is the query.
http://www.example.com/image.jpg?CacheTime=day
I want this to be cached for one week:
http://www.example.com/image.jpg?CacheTime=week
I want this to be cached for one year:
http://www.example.com/image.jpg?CacheTime=year
These links all have the same file path, filename and extension. The only thing that is different is the query.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.