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.
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?
Redirects are cached. When the visitor arrives at your real page and the browser attempts to load the image the browser sees (remembers) the redirect to the HTML page. It follows that, discovers the content is not an image and so does not display it.
Adding additional HTTP headers to prevent the redirect response being cached may help, or may cause yet more problems.
With image cache turned off in htaccess this code breaks the 'view original image' link and sends the visitor to your home page. It only works for the view original image link since Google sends no referrer when requesting/displaying the image itself and some minor bot protection *should* keep other problems at bay.
I don't think this improves the user experience but it shouldn't hurt your metrics if visitors backpage since that is the only thing you can do when viewing an image directly anyway. This is nothing more than a hack to break the view original image directly link since that's not something everyone wants happening with their images in the first place, at least not without having a chance at a visitor.
I have this in a htaccess file inside 8 different image directories. It works beautifully in Google image search, but the redirect is a 302. When I replace [L] with [R=301,L] the image becomes broken when visitors click on "view original image".
I am concerned that Google may have deindexed some images because of this 302. All of the images that were performing well in a particular directory have all now been deindexed and also, one particular image in another directory. This particular directory that was hit, is also the only directory on my site that has numerous backlinks from russian spam sites - so I am not sure if it is related to the redirection or not.
Is there a way to get the images to display properly using R=301?