Hi, I've just finished a drupal project and I'm going through optimization phase of the site. I've checked cache blocks and CSS and JS aggregation under performance for better load time . but something I noticed, when I run a page speed test or Yslow everything passes but Leverage browser caching. It seems like the expiry date is not set on all the images and css files. My question is do I have to edit .htaccess file or do I need to place the images and css files that are not cached into a particular folder?

Any help is appreciated, many thanks in advance

CommentFileSizeAuthor
Untitled-1.jpg426.53 KBnino2armando

Comments

lyricnz’s picture

Title: Cache Problem! » Files delivered by webserver have no explicit expiry
Priority: Major » Normal
nino2armando’s picture

@lyricnz , thanks for your reply. Can you Explain little bit more please, I'm not sure if I quiet get that.
Thanks

lyricnz’s picture

These files are being served up directly by your webserver, without any involvement from Drupal. This is explained quite well by page-speed, and the Apache page referenced from there

http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowse...
http://httpd.apache.org/docs/2.2/caching.html

You may want to configure you web-server to provide some of these. Depending on it's configuration, it may provide last-modified information, so the browser can do exponential backoff etc.

nino2armando’s picture

@lyricnz , Thanks A lot for your reply, I've tried all different settings on my .htaccess to set the expiry date on some of the CSS files and images but it doesn't seem to be working for me. I'm using page speed online which can be found here : http://pagespeed.googlelabs.com/ and here is the link to my site : http://backbone-design.com/
any suggestions
Many thanks in advance

nino2armando’s picture

Status: Active » Closed (fixed)

@lyricnz Thanks for all your help here is the configuration the I was looking for.

# 3 Month

<FilesMatch".(flv|gif|jpg|jpeg|png|ico|swf)$">
    Header set Cache-Control "max-age=7257600"
</FilesMatch>

# 1 Week
<FilesMatch".(js|css|pdf|txt)$">
    Header set Cache-Control "max-age=604800"
</FilesMatch>
 
# 10 Minutes
<FilesMatch ".(html|htm)$">
    Header set Cache-Control "max-age=600"
</FilesMatch>
 
# NONE
<FilesMatch ".(pl|php|cgi|spl)$">
    Header unset Cache-Control
    Header unset Expires
    Header unset Last-Modified
    FileETag None
    Header unset Pragma
</FilesMatch>