如何禁用Apache的缓存? [英] How to disable cache of Apache?

查看:226
本文介绍了如何禁用Apache的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在/var/www/html中仅放置了index.html. 更改index.html的内容并重新加载后,页面不会更新.

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

我已经在httpd.conf中禁用了cache_module,如下所示.

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

推荐答案

如果您使用的是htaccess,则可以这样做

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>

这篇关于如何禁用Apache的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆