大网数据广告活动
网站运营与故障问答

Prevent Google from indexing images

· 52CE 我爱测

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…

问题原文

原帖链接 · Voko · CC BY-SA 4.0

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?

社区高分解答

原帖链接 · Anuvesh · CC BY-SA 4.0

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$

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2019-12-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。