apache - 如何禁用Apache的缓存?

标签 apache caching

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

我已经像下面这样在 httpd.conf 中禁用了 cache_module 。

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

最佳答案

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

#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 - 如何禁用Apache的缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22891965/

相关文章:

apache tomcat 上的 Java Web 应用程序

android - VS 2015 RC Apache Cordova 空白 appTemplate 构建失败

apache - 从 XAMPP 的 apache 连接到 Elasticache 的 Redis

ios - 无法清除UIWebView缓存

asp.net - 从 SQL 切换到独立的 Redis

php - CodeIgniter "content encoding error"

apache - 如何使用 htaccess 重写 url 并保持相关链接正常工作

ios - 在 mapView 中加载区域的所有图 block

ASP.NET 输出缓存不适用于 IIS7.5

qt - 如何在 CMake 项目中使用提前生成 QML 缓存?