Forum Moderators: phranque
Can I use htaccess to force a new file every time the page is called? Can this work for images/swf/etc?
thanks in advance
Usually, a compromise approach works better -- Allow caching, but for only a limited amount of time.
A combination of Apache mod_expires and mod_headers can be used to control caching:
# Set up Cache Control headers
ExpiresActive On
# Default - Set http header to expire everything 1 week from last access, set must-revalidate
ExpiresDefault A604800
Header append Cache-Control: "must-revalidate"
# Apply a customized Cache-Control header to image files
<FilesMatch "\.(swf¦gif¦jpg)$">
ExpiresDefault A60
Header unset Cache-Control:
Header append Cache-Control: "no-cache, must-revalidate"
</FilesMatch>
# Mark error pages as non-cacheable
<FilesMatch "^(401¦403¦404¦410)\.html$">
ExpiresDefault A1
Header unset Cache-Control:
Header append Cache-Control: "no-cache, must-revalidate"
</FilesMatch>
Jim