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

If I disable indexing from the CDN server robots.txt file will this create an SEO issue?

· 52CE 我爱测

I have 1 own website and 1 CDN server. I have CSS, JS and images on my CDN server. All the CSS, JS and images on my own website come from the CDN server. If I block my CDN server with a robots.txt file, will images on my own webs…

问题原文

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

I have 1 own website and 1 CDN server. I have CSS, JS and images on my CDN server. All the CSS, JS and images on my own website come from the CDN server.

If I block my CDN server with a robots.txt file, will images on my own website but whose URLs are on the CDN be indexed? Also, does Google Bot ignore CSS and JS files?

已采纳解答

原帖链接 · Maximillian Laumeister · CC BY-SA 4.0

The robots.txt standard is per domain/subdomain. So the file at cdn.example/robots.txt will control access to resources on cdn.example, and the file at yoursite.example/robots.txt will control access to resources on yoursite.example.

What this means is that for example if cdn.example/robots.txt has a User-agent: * ⏎ Disallow: / directive, all resources on cdn.example including images will be blocked. So in that case if you have a web page on yoursite.example that tries to load those CDN images as part of the page, those images will be blocked from being accessed by the crawler, so the crawler will render your page without the images.

Google bot uses CSS and JS files to render and rank your page properly. It will complain if you don't allow it access, and it may demote your site somewhat due to not being able to check it for mobile friendliness, page load time (part of "page experience"), etc. Definitely do not block CSS or JS files from being crawled by Google.

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

资料来源与适用范围

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

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

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