Example: Google's image search engine displays images with a 'view full size image' link. Clicking on that link displays the image on its own url only and not the page the image is on. I do not like this use of my images or the backlinks directly to the image url it creates.
I need some help with a solution in htaccess for Google.com.
RewriteCond %{REQUEST_URI} ^/images/my-image.jpg$ [NC]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?google\.com [NC]
RewriteRule (.*) http://www.example.com/page-the-image-is-on
This *almost* works.
- Images must not be cached by browsers for this to work, check.
- Google image search does not provide a referrer when loading images but they do via the 'show full size image' which is great.
- The code above acts like hotlink protection vs Google but my image does show up in image search, Google uses their cache copy instead.
The above code does exactly what I want it to except for one little problem. When a visitor sees my image in Google image search and they click on the 'view full size image' link they are redirected to the page my image is on... but the image doesn't show up. It shows up if you hit the refresh button in the browser, but I can't figure out why it's not there when redirected with the above.
If caching is enabled then the above does not redirect at all, the image is loaded straight from browser cache and the request is never made. How do I keep cache off but have the image show up immediately without needed to refresh the page? It should be doing that already but it's not. Suggestions?