: Making one image non-indexable to search engines in webpage On my contact page, its a form where people can select a department to contact, then they fill out basic information (name, email
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 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?
More posts by @Harper822
1 Comments
Sorted by latest first Latest Oldest Best
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: 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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.