Serving the Compressed
For a while, I have been looking (googling) for a way to serve up precompressed files. I have the server configured to compress files on the fly; but I knew there was a way to precompress files. Since I’m not an apache url rewriting expert, this one eluded me.
However, I just ran across a talk on MySql performance and scalability (take a read it has some good real world knowledge). The gem for me was at the end of the presentation on the last slide.
AddEncoding gzip .gzip # If the user accepts gzip data RewriteCond %{HTTP:Accept-Encoding} gzip # … and we have a .gzip version of the file RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}.gzip -f # then serve that instead of the original file RewriteRule ^(.*)$ $1.gzip [L]
I have googled for that for far too long. It’s simple now that I see it, I just wasn’t able to put it all together for some reason. Guess I was expecting something more complicated. Anyway, I’m jotting it down here so I don’t forget (or the link goes away for some reason). I want to implement this real soon.