theme selector

light blue screenshot grey screenshot navy screenshot dark green screenshot red and black screenshot
 

by Tony Chang
tony@ponderer.org

All opinions on this site are my own and do not represent those of my employer.

Creative Commons Attribution License

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.

AddOutputFilterByType DEFLATE text/xml text/css application/x-javascript

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.

allowed HTML: a, blockquote, ul, ol, li, dl, dt, dd, b, i, strong, em, code, abbr, acronym, sub, sup, span, pre

allowed HTML: a, blockquote, ul, ol, li, dl, dt, dd, b, i, strong, em, code, abbr, acronym, sub, sup, span, pre