How to disable cache of Apache?

2020-03-19 14:43发布

I put only index.html in /var/www/html. The page doesn't update after I changed the contents of index.html and reload.

I already disable cache_module in httpd.conf like this below.

# LoadModule cache_module modules/mod_cache.so
# LoadModule disk_cache_module modules/mod_disk_cache.so

1条回答
ら.Afraid
2楼-- · 2020-03-19 15:37

if you are using htaccess then you can do like

#Initialize mod_rewrite
RewriteEngine On
<FilesMatch "\.(html|htm|js|css)$">
  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, 12 Jan 1980 05:00:00 GMT"
  </IfModule>
</FilesMatch>
查看更多
登录 后发表回答