an apache trick
Jun 15, 2005, 12:04am EDT
Over the weekend I learned that serving gzipped files in apache is as simple
as adding a single line to my .htaccess
file.
Of course, you can add whatever mime types you want like
text/plain
or text/html
and apache will
automatically gzip the content if the user’s browser can handle it. What I
really like about this is that it even compresses CGI code so the content of
your scripts will automatically be compressed too. This may break some
scripts that try to incrementally send data to the browser, so use it
carefully. On the other hand, it makes sense to compress all my RSS feeds
(XML) since there’s little benefit to being able to render incrementally (do
any aggregators even try to render incrementally?).
I was going to also describe how I handle the clean/short urls on this site using apache, but that will have to wait for a different post.