htaccess redirect from images to page

IronWing

No Lifer
Jul 20, 2001
71,323
30,863
136
I'm trying to modify my .htaccess redirect in order to allow search engines to return results on an image search while redirecting direct image links to the hosting page.

The script I was using redirected direct links to an error image to prevent image leaching:

Code:
SetEnvIfNoCase Referer "^http://mysite.com/" local_ref=1 
SetEnvIfNoCase Referer "^http://www.mysite.com/" local_ref=1 
<FilesMatch ".(gif|GIF|jpg|JPG|jpeg|png)"> 
Order Allow,Deny 
Allow from env=local_ref 
</FilesMatch> 
ErrorDocument 403 /redirect.gif

With this redirect neither google nor bing will return the images in an image search. The behavior I'm looking for is similar to Flickr's where the images are searchable but direct links to image files take the browser to a webpage instead.