apache php 不缓存配置

  ExpiresDefault可以设置所有文件的缓存时间 针对php设置 header, “private, must-revalidate” 设成这个还能够后退,没搞清楚原理,但每次刷新不会使用旧的缓存。

ExpiresDefault "access plus 2 day"
ExpiresByType text/php "access plus 5 seconds"
<FilesMatch ".(php)$">
Header set Cache-Control "private, must-revalidate"
Header set Pragma "no-cache"
</FilesMatch>

 

参考

http://httpd.apache.org/docs/2.2/mod/mod_expires.html
http://www.jb51.net/article/15009.htm

updatedupdated2023-12-062023-12-06