How do I set noindex headers on Netlify?

The Citead team, updated

In short. Configure X-Robots-Tag: noindex in Netlify’s _headers file or netlify.toml for served files, while keeping the resource accessible to crawlers.

Definition: X-Robots-Tag: noindex is an HTTP response header that instructs supporting search engines to exclude a resource from search results. As of 17 October 2026, Netlify supports configuring it for served files through _headers or netlify.toml.

Key facts

  • Netlify's custom headers documentation places _headers in the publish directory, the folder containing the finished files deployed after the build.
  • Google's noindex documentation requires crawl access to the resource so that Googlebot can read the header.
  • Google's robots specifications support X-Robots-Tag on non-HTML resources, including PDFs, videos and images.

What goes in the _headers file?

Netlify's header syntax places each URL path above its indented headers. This configuration applies noindex across the site:

/*
  X-Robots-Tag: noindex

For a single resource, /* can be replaced with its URL path. The file must reach the publish directory after the build; placing it only in the source repository is insufficient if the build excludes it.

How does the netlify.toml version work?

Netlify's file-based configuration documentation normally places netlify.toml at the repository root and defines header rules with [[headers]]. The equivalent configuration is:

[[headers]]
  for = "/*"
  [headers.values]
    X-Robots-Tag = "noindex"

The for value selects the URL path; headers.values contains the response headers. The same documentation states that these headers apply globally across builds. A sitewide rule therefore needs particular care when production pages should remain eligible for indexing.

Which responses need another approach?

Netlify's documented limitations restrict these custom headers to files served from its backing store. For proxied content or URLs handled by functions or edge functions, including server-rendered pages, the upstream site or function must return X-Robots-Tag: noindex itself.

How can the result be checked?

The response for the deployed resource should contain:

X-Robots-Tag: noindex

Google's implementation guidance explains that the header and the HTML robots meta tag have the same indexing effect. It also identifies Search Console's Page Indexing report as a way to monitor pages where Googlebot extracts noindex.

Googlebot needs to crawl the updated response before the change takes effect in Google Search. Blocking the URL in robots.txt, the file that controls crawler access, prevents Googlebot from reading the directive. Google also states that putting noindex inside robots.txt is unsupported.

FAQ

Can I limit the header to a staging branch?

Netlify's context-specific header procedure uses separate header files copied into the publish directory by the relevant context's build command. You must remove global declarations when following that procedure.

Google's robots rules define nofollow separately. If you need both instructions, the combined header value is noindex, nofollow; none has that combined meaning too.

Sources

  1. Netlify, "Custom headers", 1 December 2025
  2. Netlify, "File-based configuration", 17 September 2026
  3. Google Search Central, "Block Search indexing with noindex", 10 December 2025
  4. Google Search Central, "Robots meta tag, data-nosnippet, and X-Robots-Tag specifications", 24 March 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark