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

X-Robots-Tag: noindex on an HTTP 302 response to remove subdomain

· 52CE 我爱测

This very related to this question "X-Robots-Tag: noindex" on an HTTP 301 response , however I don't see a definitive answer. We have subdomains we use for our affiliate links, the affiliates publish a link to the subdomain which…

问题原文

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

This very related to this question "X-Robots-Tag: noindex" on an HTTP 301 response, however I don't see a definitive answer.

We have subdomains we use for our affiliate links, the affiliates publish a link to the subdomain which in turn 302 redirects to the main site.

However the subdomains are being indexed (as you usually find with 302 redirected URLs) and I would like to remove them from from the index.

I thought about removing them in GWT using URL removal, but I think they may become indexed again, so I was wondering about the possibility of using an X-Robots-Tag HTTP header in conjunction with the 302 redirect.

Can you use both together, or will only 1 be seen? If both are seen, will the noindex work; or would you just go the route of removing in GWT?

社区高分解答

原帖链接 · Roberto Tyley · CC BY-SA 4.0

As of December 2022, Google will respect a X-Robots-Tag HTTP Response header that comes as part of a HTTP 302 response - Google Search Console will report: "Indexing allowed? No: 'noindex' detected in 'X-Robots-Tag' http header".

I've verified this in my role as a developer on theguardian.com, ie, having added a X-Robots-Tag HTTP Response header to the redirecting url https://www.theguardian.com/business/series/buying-black/latest :

% curl --silent -I https://www.theguardian.com/business/series/buying-black/latest
HTTP/2 302
location: /business/2022/dec/14/buying-black-history-could-help-everyone
...
x-robots-tag: noindex
...

...then even attempting to explicitly index the page in Google Search Console fails, which is exactly what we want:

So, thankfully it's no longer necessary to avoid 302 redirects (eg using an awful Javascript redirect) just to get Google to not index a redirecting url.

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

资料来源与适用范围

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

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

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