I believe your substitution string has to be a legit URI ( http://something/something$1 ). If you're pulling the images from an "images directory" you'll prolly need a rewrite rule for requests from that dir also.