我的网站在多次尝试禁用后仍然从缓存加载

  • 本文关键字:加载 缓存 网站 html caching
  • 更新时间 :
  • 英文 :


当我(和用户(加载网站时,我的网站从缓存加载时,我一直在努力解决这个问题。我在我的html中添加了这些元标签来防止这种情况:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />

但这并没有奏效。然后我将这些添加到.htaccess文件中:

<IfModule mod_headers.c>
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</IfModule>
<FilesMatch ".(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
<IfModule mod_headers.c>
FileETag None
Header unset ETag
Header unset Pragma
Header unset Cache-Control
Header unset Last-Modified
Header set Pragma "no-cache"
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
</IfModule>
</FilesMatch>

它也不起作用。

我在链接中添加了一个带有随机数的?Version=,它也不起作用。

我甚至在浏览器中禁用了从缓存加载网站,但它仍然从缓存加载。

我该怎么做才能最终阻止网站从缓存加载?有些浏览器可以正确显示它(例如firefox(,但我使用最多的Opera不会。

编辑:它似乎把更多的版本拼凑在一起。例如,我测试了它:当我更改文本时,它会更改,但有些颜色不会更改。

您应该尝试查看浏览器的设置。似乎它们是你遇到麻烦的主要原因(因为有些浏览器显示正确,有些则不正确(

最新更新