I have a site where all my images are stored in a specific folder, for example /images/984728176386375837629856e.png
but I don't want this page to appear on the SERP. Can I disable the indexing of the image
folder with robots.txt
?
1 Answer
From the Google Search Console help docs:
If you want Google to exclude the
image-name-here.png
that appears on your site atwww.example.com/images/image-name-here.png
, add the following to your robots.txt file:User-agent: Googlebot-Image Disallow: /images/image-name-here.png
The next time Google crawls your site, it will see this directive and drop your image from the search results.
To remove all the images on your site from being indexed, add the following to the robots.txt file in your server root:
User-agent: Googlebot-Image Disallow: /
Additionally, Google has introduced increased flexibility to the robots.txt file standard through the use of asterisks. Disallow patterns may include "*" to match any sequence of characters, and patterns may end in "$" to indicate the end of a name.
To remove all files of a specific file type (for example, to include .jpg but not .png images), you'd use the following robots.txt entry:
User-agent: Googlebot-Image Disallow: /*.gif$