I'm getting a bit carried away by this now, and someone needs to stop me
I've applied the same idea to assist with reducing bandwidth
In my .htaccess file I've added this:
Code:
#
# avatar.php rewriting
#
# av1-1053412959.gif = userid + dateline
RewriteRule ^av([0-9]+)-([0-9]+).gif$ avatar.php?userid=$1&dateline=$2 [L]
#
# attachment.php rewriting
#
# atp157156.gif = postid + extension
RewriteRule ^atp([0-9]+).([a-z]+)$ attachment.php?postid=$1 [L]
# att157156.gif = attachmentid + extension
RewriteRule ^att([0-9]+).([a-z]+)$ attachment.php?attachmentid=$1 [L]
And you should be able to figure the rest out
Simply change all references of avatar.php?userid=$post[userid]&$post[dateline]... and variations, for av$post[userid]-$post[dateline].gif
Don't worry about the extension, the correct mime-type will be returned by the php... and that's whats important.
Then change template postbit_attachment so that the URL for attachments is this : atp$post[postid].$post[attachmentextension]
Note that this also sidesteps a bug in Mozilla whereby downloading a zip file from a php page would prompt a php file extension rather than zip.
I've been hacking for sure, and again I don't recall clearly every change I made. But if you got the gist of everything else in this thread then I've no doubt you can do this.
Essentially the point is that a lack of querystring allows the browser and proxies/caches to cache the avatars and attachments.
This obviously reduces bandwidth... and also reduces database load.
I have high hopes for this little addition to this very fine hack