I put a static cache of my Ruby/Python post since it's been
pretty popular and this blog software is very slow (among many of its
flaws). I got it wrong at first and made it static regardless of what
you tried to do, which mean that commenting was also broken (so that's
why commenting stopped...). Anyway, here's the rule I ended up with:
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond /home/blog/static_cache/%{REQUEST_URI} -s
RewriteRule (.*\.html)$ /home/blog/static_cache$1 [L]
The idea is that only when there's no GET variables (the first rule),
it is a GET request (not a POST; second rule), and file with that name
exists on disk (third rule), then serve up that file, assuming it ends
with .html. (Incidentally, mod_rewrite actually applies the
RewriteRule first, then applies the conditionals)
Then I have a cron job that runs this script periodically:
cd /home/blog/static_cache
for F in `cat /home/blog/static_cache_files.txt` ; do
wget -q -O $F "http://blog.ianbicking.org/$F?nocache"
done