RewriteEngine On
RewriteCond "%{QUERY_STRING}" "[0-9]+$"
RewriteRule "^.*$" "$0" [L,E=CACHE:True] # Match all.
Header onsuccess set "Cache-Control" "public, max-age=31536000" env=CACHE
Dependencies: mod_rewrite
and mod_headers
Please contact me if you know an even nicer way.