2

On my contact page, its a form where people can select a department to contact, then they fill out basic information (name, email and message).

Additionally, a PHP script is called (via the HTML IMG tag) to load an image that shows the digits one has to exactly type in a box to confirm the message composer is an actual human. The digits are randomly generated on every load. I can't use text to generate the random text or spam bots could detect the digits easier.

Having said all that, what I'm noticing in my server logs is that the google image bot is accessing this number-generating PHP script about once a week. I bet it is trying to index it as a user searchable image on the web.

I check google documentation on ways to specifically make the image (number-generating script) non-indexable and they were suggesting no-indexing the whole page the image is on.

I did read at https://moz.com/community/q/should-i-index-or-noindex-a-contact-page that not-indexing a contact page is not a good idea.

There was also a suggestion to block the file in robots.txt but this could entice hackers to try to spam the site more. I'd rather keep my robots.txt as clean as possible.

Is there an easy way to specifically make only one image in a page non-indexable and leave the rest of the links in the same page indexable?

  • I would have used the robots.txt file... but your point can be a perfectly valid one. In my experience I have not seen too many hackers go after anything in the robots.txt but rather ignore it completely which may be the same thing. Perfectly intriguing question as always!! – closetnoc Sep 27 '15 at 0:47
  • Out of interest why would you 'NOT' want to index an image which is obviously important to your visitors? I don't see why indexing would make it any less safe or less effective against spam. – Simon Hayter Sep 27 '15 at 8:58
  • Also, if you type the URL of the page in question into Google and then click images, the ones in the top left are the ones indexed, or you can define it even more by typing the URL of the image, if its not top left, its not indexed... but again, what do spammers have to gain by having those indexed by Google. Spammers use decaptcha services, which will cost them as low as $0.01 for each one cracked, they don't use Google, they actually scan the image on the page, again, nothing to do with Google. – Simon Hayter Sep 27 '15 at 9:18
  • the image is only of interest to the visitor when he uses the contact form. The image is only of a series of white numbers in a black box. If google indexes it, then people might come across random numbers on google's image page. Apart from that, the image is useless to visitors. – Mike Sep 27 '15 at 15:34
1

If you just want a single image not to be indexed (or any non-HTML resource for that matter), then send an X-Robots-Tag: noindex HTTP response header with the resource. This is equivalent to setting a noindex robots meta tag when specifying that you don't want an HTML page to be indexed.

Since you are generating this particular image with a PHP script then it would be easy to incorporate this as part of the script:

<?php
header('X-Robots-Tag: noindex, noimageindex');

(To be honest, I'm not sure sure which, noindex or noimageindex, would be required in this instance - but there is no harm having both.)

Reference:
https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag?hl=en

However, as has already been mentioned, I don't see as there is any harm in blocking this with robots.txt - this would be required in order to stop Google from crawling the image (and to stop it from appearing in your server logs). In fact, I think blocking your script with robots.txt would be the preferred approach IMO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.