caching - Apache Vhost Directives Optimized for Pagespeed -
i use setup in vhost:
<location /> setoutputfilter deflate browsermatch ^mozilla/4 gzip-only-text/html browsermatch ^mozilla/4\.0[678] no-gzip browsermatch \bmsi[e] !no-gzip !gzip-only-text/html setenvifnocase request_uri \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary header append vary user-agent env=!dont-vary </location> <directory /> expiresactive on expiresbytype text/html "access plus 5 minutes" expiresbytype text/css "access plus 1 month" expiresbytype application/x-javascript "access plus 1 month" expiresbytype application/javascript "access plus 1 month" expiresbytype text/javascript "access plus 1 month" expiresbytype image/gif "access plus 1 month" expiresbytype image/png "access plus 1 month" expiresbytype image/jpg "access plus 1 month" expiresbytype image/jpeg "access plus 1 month" expiresbytype image/x-icon "access plus 1 month" expiresdefault "access plus 1 day" <filesmatch "\.(ico|jpeg|pdf|flv|jpg|png|gif|js|css|swf)$"> header set cache-control "max-age=2592000, public" header unset last-modified header unset etag fileetag none </filesmatch> <filesmatch "\.(html|php)$"> header set cache-control "max-age=900, public, must-revalidate" </filesmatch> </directory>
while works great speeding thing, users dont see changes themselfs made on content (mainly while using firefox) :( suggestions / optimization hints?
instead of forcing browser cache, should send must-revalidate header , control caching within programming language (for example, php) sending expires , last-modified header. browser ask site latest version on each request, make sure answer empty page if nothing has changed.
this may take time implement, works.
Comments
Post a Comment