Images and redirect responses are cached. Are you clearing the cache before each test?
You say you want a rewrite, but your code is for a redirect. Which do you want?
Usually a rewrite is better, as it serves the alternative image at the originally requested URL. There's no guarantee that having served the redirect the requester will actually follow it.