开发者

Make an image invisible to Search Engines and Facebook?

开发者 https://www.devze.com 2023-03-10 15:48 出处:网络
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 Sear

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 ba开发者_Go百科ckground image as the image itself?

Thank you, Aaron


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.


Not sure if you can select a certain image to hide. You can hide all JPG files from search bots with this though:

User-agent: *
Disallow: /*.jpg


You can add server-side code to only emit the <img> tag if the User-Agent isn't Facebook or a spider.

0

精彩评论

暂无评论...
验证码 换一张
取 消