apache 中:
<VirtualHost 10.11.12.47>
DocumentRoot /usr/local/resin/htdocs/
ServerName www.test.com
DirectoryIndex index.html index.jsp
CustomLog logs/info/access_log combined
ErrorLog logs/ding/error_log
ExpiresActive on
ExpiresByType image/gif A31536000
ExpiresByType image/jpeg A31536000
ExpiresByType image/jpg A31536000
ExpiresByType text/css A31536000
ExpiresByType application/x-javascript A31536000
<Location /script>
<IfModule mod_expires.c>
FileETag None
ExpiresActive on
ExpiresByType application/x-javascript A0
</IfModule>
</Location>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/sf/.*/.js$ http://192.168.12.123:8080%{REQUEST_URI} [P]
</IfModule>
html中:
<meta http-equiv=Pragma content=no-cache>
<meta http-equiv=expires content=0>
<meta http-equiv="cache-control" content="no-store">
jsp中:
response.setHeader( "Pragma", "no-cache" );
response.addHeader( "Cache-Control", "must-revalidate" );
response.addHeader( "Cache-Control", "no-cache" );
response.addHeader( "Cache-Control", "no-store" );
response.setDateHeader("Expires", 0);
apache ,html,jsp 避免页面中的部分资源被cache
本文介绍了Apache服务器中关于缓存设置的具体配置方法,包括如何为不同类型的文件设置缓存过期时间,以及如何通过重写规则将特定请求转发到其他服务器。此外还涉及了如何在HTML和JSP中禁用浏览器缓存。

被折叠的 条评论
为什么被折叠?



