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

Stop any search engine from indexing/crawling images in a dedicated folder in wp

· 52CE 我爱测

How can I prevent a dedicated image folder from crawling/indexing by any search bot? Like Google search or image or Bing search/image bot? I would like to give that folder name as /donotindex/ here will be all image that I will u…

问题原文

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

How can I prevent a dedicated image folder from crawling/indexing by any search bot? Like Google search or image or Bing search/image bot?

I would like to give that folder name as /donotindex/ here will be all image that I will upload for users profile picture and others. Also, what's most easy way to prevent anyone from browsing this folder files?

社区高分解答

原帖链接 · Henry Visotski · CC BY-SA 4.0

In your robots.txt file, assuming this folder is at the root, include the following:

User-agent: *
Disallow: /donotindex/
...

The ellipsis on line 3 simply stands in for any other Disallow or Allow directives for all bots. If none exist, omit it.

This will prevent all mainstream bots from crawling the folder or indexing what's in it. This might not prevent your content from ending up in the index, though; for example, if that picture's URL is copied and linked to by another page, it might still get discovered. Plus, not all bots are polite enough to obey robots.txt directions.

In WordPress, there are a few things you can do to prevent your images being linked to. This article describes the various techniques, mostly using the WPShield Content Protector plugin, which can help you do the following:

  • Disable Right Click and Dragging Images
  • Hide Image URLs
  • Disable Image Hotlinking

If you want your folder inside your web hosting panel to be accessible on the backend only to you (the admin) and not to anyone else who might be working on your website, check with your web host on how to restrict that folder access.

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

资料来源与适用范围

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

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

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