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

How can I stop Google from indexing embedded iframes?

· 52CE 我爱测

I have iframe widgets of external sources embedded on my website. For some reason Google seems to be indexing the URLs of the iframes and showing 404 errors for such URLs in the Crawl Section of Google Webmaster Tools. How can I …

问题原文

原帖链接 · Yin Yang · CC BY-SA 3.0

I have iframe widgets of external sources embedded on my website. For some reason Google seems to be indexing the URLs of the iframes and showing 404 errors for such URLs in the Crawl Section of Google Webmaster Tools. How can I stop Google from doing that?

The URLs don't follow a pattern so I don't think I can use robots.txt for it. Would rel="nofollow" work for iframes?

已采纳解答

原帖链接 · dan · CC BY-SA 3.0

For some reason Google seems to be indexing the URLs of the iframes

As covered here, Google will indeed try to crawl and associate framed content with the page containing the frames.

Would rel="nofollow" work for iframes?

Within the header section of the iframe page (not the parent page containing the iframe), use:

<meta name="robots" content="noindex, nofollow">

As explained by Google here, this:

instructs web crawlers to not index the page and to not crawl any of the links on the page.

(If you just want to target the Googlebot and not other crawlers, then change name="robots" -> name="googlebot")

Based on pretty extensive experience with iframes, I can confirm that this prevents iframe pages from being indexed, while still allowing the parent page containing the iframe to be indexed.

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

资料来源与适用范围

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

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

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