Recent changes to how Google and Bing serve the results in their image search have
upset many webmasters because they now get far less traffic from those searches than they had before. The
search engines no longer require users to actually visit the pages where the images reside in order to see
them in their original, full-size form. This has led some websites to want to remove their images from the
search engines. The question is, of course, how best to do it without impairing public access to these images.
The simplest way to block your images from being included in the search engines is to use
a "Disallow" instruction in your robots.txt file. This is usually a straightforward task, since
website designers typically store all images in a single directory. So, for example, if your images are all
contained in a directory named "images", you'd simply add the following to your robots.txt file:
However, this simple approach doesn't really address the situation that we're discussing where the search engines have already crawled and indexed all of your image files. When you add a "Disallow" instruction to your robots.txt file, it only tells the search engines not to crawl the affected documents. Those documents will tend to fall out of the index over time, but it can be a very long wait. If you're particularly anxious to remove your images from the search engines' index as quickly as possible, you'll need to take further action.
Removing normal HTML documents from the index is a very straightforward process because all that is required is to add a robots <meta> tag set to "noindex" and either wait for the search engines to discover that tag in due course, or force things by using the "Fetch As Googlebot" function in Google's Webmaster Tools console. But since image files obviously can't include a <meta> tag, you need to use a different mechanism: the .htaccess file.
Among the many changes that the search engines have all incorporated in recent years is support for the "x-robots-tag" in the response header information that servers return in response to all HTTP requests. The purpose was to accommodate situations where it wasn't possible to use a robots <meta> tag, as we're addressing here. Any instruction that you would be able to use in a robots <meta> tag can be used with this method.
As usual, the many commands available in an .htaccess files means there are several ways to
add an "x-robots-tag" header. The best choice boils down to the situation involved, but since we're
dealing with a particular kind of file and we don't really care where that file resides on the server, the
"FilesMatch" command seems most appropriate. I've found a few usable variations online, but I
suggest the following:
This instruction tells the server to add our "x-robots-tag" set to "noindex" to all files that end with the typical image file suffix. In order for this instruction to work, you MUST NOT BLOCK YOUR IMAGES IN YOUR robots.txt FILE!. If you block your images in robots.txt, the search engines will never see the "x-robots-tag" and you'll end up having to wait for them to drop out of the index on their own.
This approach will greatly speed up the process of removing your images from Google and Bing, but you'll still have to wait for them to crawl these images and see the "x-robots-tag". So it can take several weeks for all of your images to be removed. But it will still be much faster than simply blocking them in your robots.txt file and waiting for them to drop out because the search engines tend to retain files that have been blocked this way to allow for the possibility that the webmaster has made a mistake. Once all of your images have been removed from Google, you can certainly add the block to your robots.txt file.
This page was last updated on April 25, 2016.
Need More Help?
You'll find more SEO Tips on the menu on the right side of this page.
You can also contact me with your SEO questions.
If you can't fix your website search engine problems on your own,
my Search Engine Optimization Services
can give your website what it needs to get your business' fair share of search engine traffic quickly, without disturbing your website's design, and without breaking your budget.
Call Richard L. Trethewey at Rainbo Design in Minneapolis today at 612-408-4057 from 9:00 AM to 5:00 PM Central time
to get started on an affordable website design package or search engine optimization program for your small business today!
In writing these SEO tips, I'm often reminded of a pearl of wisdom that my high school computer programming teacher passed on from one of his teachers, "Computers are high-speed idiots!" Remember that, and don't let them get under your skin.