Forum Moderators: phranque

Message Too Old, No Replies

Trouble with caching images

.htaccess

         

StoutFiles

3:54 pm on Mar 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The following used to work on my website but I had everything reinstalled on it. When moving all my files back on the server, the .htaccess file caused a 500 internal error. The faulty script is below:

<FilesMatch "\.(gif¦jpe?g¦png¦ico¦pdf¦flv¦swf¦js¦PNG)$">
#
Header unset Cache-control
#
ExpiresActive On
ExpiresDefault A259200000
#
</FilesMatch>
FileETag none

Is there something wrong with this script...it used to work on my server and works on another...now it causes problems. Any suggestions?

jdMorgan

4:42 pm on Mar 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Suggestions:

1) Look at your server error log. If you recently "had everything re-installed," then it's likely that an Apache module which was previously installed and enabled is either no longer installed or no longer enabled.

2) Your default Expires time is unreasonably long. There is little chance that a client-side cache entry will survive for more than 30 days, and almost no reduction in server bandwidth to be gained with a setting higher than 2,592,000 -- one one-hundredth of your current setting.

In fact, a plot of caching benefit versus cache persistence time shows a very strong "knee curve," with the most improvement from zero to 48 hours, modest improvement from 48 hours to one week, a small but significant improvement from one week to a month, and almost no gain above that.

The same is true of cache benefit plotted against cache size -- The incremental gain falls off as the cache size is increased, until the point where further increases in size result in effectively zero benefit.

Jim