Search code examples
cssimagefacebookxhtmlsearch-engine

Make an image invisible to Search Engines and Facebook?


When I try to add a link of Facebook, it reads every image as a thumbnail and I do not want that. Is there anyway I can remove that feature of the image, because if it reads it via Facebook, then Search Engines will be able to index the image. Any idea without having to make a specific class in the css that uses the background image as the image itself?

Thank you, Aaron


Solution

  • You can also use .htaccess to do that.

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain\.com [NC]
    RewriteRule \.jpg$ http://some-image-location [NC,L]
    #RewriteRule \.jpg$ - [NC,L]  # this will result in failed request
    

    if you put this in the root folder, then all *.jpg on your site will appear only to your domain pages, anyone linking from outside your domain will not get the image.

    If you want to restrict images from only one folder then put the htaccess in that folder.

    Note that these rules are very crude and will prevent everyone(Google, Yahoo, even hotlinking) other than your own domain from accessing the images.