# Rewriting jpg with specific google referer to 1 pixel gif

**URL:** <https://www.ruby-forum.com/t/rewriting-jpg-with-specific-google-referer-to-1-pixel-gif/226675>\
**Category:** NGINX\
**Created:** [February 18, 2013, 2:39am UTC](https://www.ruby-forum.com/t/rewriting-jpg-with-specific-google-referer-to-1-pixel-gif/226675 "2013-02-18T02:39:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [February 18, 2013, 2:39am UTC](https://www.ruby-forum.com/t/rewriting-jpg-with-specific-google-referer-to-1-pixel-gif/226675/1 "2013-02-18T02:39:33Z")

</div>

If I understand correctly, nginx doesn’t do multiple conditions in an  
‘if’  
or nested if’s.

Based on some of the ideas being tossed around in this thread  
([Google Images' New (Bing-like) Layout - Google Search and SEO forum at WebmasterWorld - WebmasterWorld](http://www.webmasterworld.com/google/4537063-11-30.htm)) I’d like to  
rewrite serve up a one pixel gif to whenever both of the two following  
conditions are met:

1. The http referer is [http://www.google](http://www.google)._/blank.html(_) and then

2. the requested asset is a jpg

What’s the best performance way to handle that?

- I suck at regex, so I just put the asterix there to signify catching  
any  
of the google country domains.

Thanks for any suggestions.
