Slashdot Mirror


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!"

4 of 29 comments (clear)

  1. Increase page load times? by daranz · · Score: 5, Funny

    Why would I want to do that?

    --
    This is a sig. It is appended to the end of comments I post.
  2. I use it all the time, but be aware.. by slashkitty · · Score: 5, Interesting
    It works great for images. I remember when I first started using it. It cut the number of http requests to the server in 1/2, and substantially reduced the bandwidth usage.

    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.
  3. caching htaccess? by oneiros27 · · Score: 4, Informative

    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.
  4. httpd.conf by Nos. · · Score: 5, Informative

    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.