X-Robots-Tag

The X-Robots-Tag is an HTTP header used to control how search engines crawl and index resources, offering more flexibility than the standard `<meta>` robots tag.

X-Robots-Tag

The X-Robots-Tag is an HTTP response header that tells search engines how to crawl, index, or follow the links on a resource. Unlike the <meta name="robots"> tag—which only works in HTML documents—the X-Robots-Tag header can be applied to any file type (PDFs, images, videos, CSS, etc.), giving you fine-grained control over which resources search engines should include in their results.


Why use X-Robots-Tag

  • File-type flexibility
    Works on non-HTML files (PDFs, images, video files), whereas <meta> tags only apply to HTML pages.
  • Server-level control
    Can be set or removed via server configuration (Apache, Nginx) or programmatically in application code.
  • Selective indexing
    Control indexing on a per-directory or per-file basis without editing each document.

Common X-Robots-Tag directives

DirectiveEffect
noindexPrevents the resource from being indexed
nofollowPrevents search engines from following any links on the item
noarchiveDisallows cached copy in search results
nosnippetBlocks text snippets or video previews in search results
noneEquivalent to noindex, nofollow
noimageindexPrevents images on the resource from being indexed

Example: Returning X-Robots-Tag via HTTP header

HTTP/1.1 200 OK
Content-Type: application/pdf
X-Robots-Tag: noindex, nofollow

X-Robots-Tag vs. Meta Robots Tag

FeatureMeta Robots TagX-Robots-Tag Header
Applies toHTML documents onlyAny file type
Location<head> section of HTMLHTTP response headers
Configuration methodInline HTML editingServer/app configuration
Use casePage-level controlGlobal or file-type–level control

In summary, the X-Robots-Tag header is a powerful tool for guiding search engine behavior across all types of resources, not just HTML pages. By adding directives like noindex or nofollow at the server level, you gain precise, centralized control over your site’s crawl and indexing rules.

Free SEO Tools

Simple, powerful tools to help you improve your website's SEO performance

SERP Checker

Enter your website and keyword to see where you rank in Google search results.

Try it free →

SEO Checker

Analyze your website's SEO and get actionable tips to improve.

Try it free →

Keyword Rankings

Discover all the keywords your website is already ranking for on Google.

Try it free →