Redirect any requests for spacer.gif to one file

I must be missing or overlooking something on this one.

I have various URLs like this:
http://example.org/2011/07/my-article-name/spacer.gif
http://example.org/2011/09/another-article-name/spacer.gif

And of course, there’s no spacer.gif at that location. So, I’m trying to redirect those requests. I’ve gone through several variations, but none of my attempts have been successful. Here’s what I happen to have at the moment (I’m testing on localhost):

#fixes broken relative paths for spacer.gif files when used in pngfix in IE6
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.*)/(spacer\\.gif)$ [NC]
RewriteRule ^$ http://localhost/images/spacer.gif [R=301,L]

Solved it. As it turns out, the .htaccess file in the wordpress theme’s folder I was working with wasn’t actually getting triggered.

Putting this in the main site’s .htaccess file did the trick:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\\.)?(example\\.org)/ [NC]
RewriteCond %{REQUEST_URI} /spacer\\.(gif)$ [NC]
RewriteRule ^.*$ http://example.org/images/spacer.gif [R=301,L]