I have an redirection when 404 is served with apache:
ErrorDocument 404 https://my404.com/image.jpg
# other rewrite rules that cannot be affected
How can I set no-cache
header only when redirection above is applied?
From this answer How to prevent http file caching in Apache httpd (MAMP) put the folowing code at .htaccess
file :
<filesMatch "image\.jpg$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>