覆盖pragma:no-cache

时间:2011-03-17 23:15:44

标签: php apache meta-tags cache-control pragma

所以我在网络主机上托管我的网站,显然配置了apache,以便设置pragma:no-cache ....

所以我试图通过将.htaccess修改为以下内容来重新启用缓存:

<Files *>
Header set Cache-Control: "private, max-age=5400, pre-check=5400"
Header set Expires: A17200
Header set Pragma: private
</Files>

以及使用php标头:

header("Cache-Control: private, max-age=5400, pre-check=5400");
header("Pragma: private");
header("Expires: " . gmdate("D, d M Y H:i:s"). " GMT");

以及使用元标记:

<META HTTP-EQUIV="Pragma" CONTENT="private">
<META HTTP-EQUIV="Cache-Control" CONTENT="private, max-age=5400, pre-check=5400">
<META HTTP-EQUIV="Expires" CONTENT="<?php echo date(DATE_RFC822,strtotime("1 day")); ?>">

但是当我从redbot.org检查网站的标题时,

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Thu, 17 Mar 2011 23:11:34 GMT
Server: LiteSpeed
Connection: close
X-Powered-By: PHP/5.2.14
Content-Type: text/html; charset=utf-8
Set-Cookie: PHPSESSID=48b583b19ab3e64d40fa640744afb31c; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
    check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Cache-Control: private, max-age=5400, pre-check=5400
Expires: A17200
Pragma: private

有两个Cache-Control条目,顶部的那个是我正在尝试覆盖的条目,但仍然是顶部的那个将是可操作的并且firefox仍然不会缓存该网站...

有什么建议吗?

0 个答案:

没有答案