Speed Up Sites with htaccess Caching
produke writes "Increase your page load times and save bandwidth with easy and really effective methods using apache htaccess directives. mod_headers to set expires, and max-age, and cache-control headers on certain filetypes. The second method employs mod_expires to do the same thing -- together with FileETag, makes for some very fast page loads!"
Why would I want to do that?
This is a sig. It is appended to the end of comments I post.
However, if you are one to be changing images around, like using a Holiday logo or something, you have to change the image file name to force browsers to reload it.
I'm sorta surprised that slashdot doesn't use this on their images:
wget -S --spider http://images.slashdot.org/logo.png
--08:31:01-- http://images.slashdot.org/logo.png
=> `logo.png'
Resolving images.slashdot.org... 66.35.250.55
Connecting to images.slashdot.org|66.35.250.55|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Date: Mon, 04 Dec 2006 14:30:12 GMT
Server: Boa/0.94.14rc17
Accept-Ranges: bytes
Cache-Control: max-age=43200
Connection: Keep-Alive
Keep-Alive: timeout=10, max=1000
Content-Length: 7256
Last-Modified: Fri, 01 Dec 2006 03:02:14 GMT
Content-Type: image/png
Length: 7,256 (7.1K) [image/png]
200 OK
-- these are only opinions and they might not be mine.
Here I was, thinking that someone had a solution for the slowdown caused by using htaccess files in the first place.
They don't.
If you're going to set caching in your server to decrease load time, make sure to set in the main configuation files, and disable htaccess, which can potentially increase the time of every page load. (the decreased hits and bandwidth may be an advantage to you -- you'll have to benchmark to see if this solution helps or hurts you for your given platform and usage patterns)
Build it, and they will come^Hplain.
Its in the comments on that site, but remember, you're always better off putting this kind of stuff in your httpd.conf as opposed to .htaccess files. htaccess files reduce performance on your webserver.