当404使用apache时,我有一个重定向:
ErrorDocument 404 https://my404.com/image.jpg
# other rewrite rules that cannot be affected
如果仅在应用上述重定向时如何设置no-cache
标题?
答案 0 :(得分:0)
从这个回答How to prevent http file caching in Apache httpd (MAMP)将下面的代码放在.htaccess
文件:
<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>