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!"
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.
On shared hosting, which most (smaller) sites use, you typically don't have access to the server configuration files. I have a shared hosted site and I'm definitly going to implement this for images and other static files.
What is the performance loss in htaccess files anyway? For instance, would it be faster to have htaccess redirect moved pages or would it be faster to have a server-side script (i.e. php, python, etc.) do redirecting?
Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?