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?


From the Google Search Console help docs:

If you want Google to exclude the image-name-here.png that appears on your site at www.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$

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.