apache不缓存的配置方法
时间:2014-07-05 13:54 来源:linux.it.net.cn 作者:IT网
在开发调试网站时,经常会碰到因浏览器缓存(cache)而经常要去清空缓存或者强制刷新来测试的烦恼。
这里提供下apache不缓存的配置方法。
apache:
首先确定配置文件httpd.conf中确已经加载mod_headers模块。
LoadModule headers_module modules/mod_headers.so
可以根据文件类型来让浏览器每次都从服务器读取,这里测试用css、js、swf、php、html、htm这几种文件。
复制代码代码如下:
<FilesMatch “\.(css|js|swf|php|htm|html)$”>
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
(责任编辑:IT)
在开发调试网站时,经常会碰到因浏览器缓存(cache)而经常要去清空缓存或者强制刷新来测试的烦恼。
apache:
可以根据文件类型来让浏览器每次都从服务器读取,这里测试用css、js、swf、php、html、htm这几种文件。
复制代码代码如下:
<FilesMatch “\.(css|js|swf|php|htm|html)$”>
(责任编辑:IT)Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache" </FilesMatch> |