X-Robots-Tag Generator – Control Indexing with HTTP Headers
Use the X-Robots-Tag Generator above to create HTTP-header indexing directives. Choose whether the rule should target specific file types, one directory, one exact path or your entire site, select the directives you need, then generate configuration for your server or hosting platform.
X-Robots-Tag is especially useful when you need to control indexing for resources that cannot contain an HTML robots meta tag, such as PDFs, images, video files, documents and generated downloads.
The tool creates ready-to-use rules for Nginx, Apache, Cloudflare Workers, Netlify and Vercel, plus the raw HTTP header to verify after deployment.
What Is an X-Robots-Tag?
X-Robots-Tag is an HTTP response header that tells compatible search engines how a URL may be indexed or presented in search results.
A simple response can contain:
X-Robots-Tag: noindex
That directive tells a supporting search crawler not to index the URL.
Unlike a robots meta tag, the instruction is delivered in the HTTP response rather than embedded inside HTML.
This makes X-Robots-Tag useful for both HTML and non-HTML resources.
When Should You Use X-Robots-Tag?
Use X-Robots-Tag when the indexing instruction belongs at the server or response level.
Common examples include:
- PDF reports
- Downloadable documents
- Image files
- Video files
- CSV exports
- Generated files
- Entire directories
- Groups of files sharing one extension
- Responses controlled at a CDN or edge layer
For a normal HTML page where you control the <head>, a robots meta tag is often simpler.
For PDFs and other non-HTML files, X-Robots-Tag is normally the practical choice because those files cannot contain a standard HTML meta element.
How to Use This X-Robots-Tag Generator
Start by choosing what you want to target.
Select File types when the same rule should apply to extensions such as PDF, CSV or EPUB.
Select A directory when everything under one path should receive the rule.
Select One exact path when only a single resource should be affected.
Select Everything only when you intentionally want the response header applied broadly.
Next, choose the directives. For example, selecting noindex tells supporting search engines not to index matching resources.
Choose your platform and generate the configuration.
After deployment, verify the real HTTP response. The configuration file may look correct while the live server still returns a different result.
X-Robots-Tag vs Meta Robots Tag
Both can provide many of the same indexing directives, but they are delivered differently.
| Method | Where It Appears | Best Use |
|---|---|---|
| Meta robots | HTML page | Normal HTML pages |
| X-Robots-Tag | HTTP response header | PDFs, files, directories and server-level rules |
| robots.txt | Root text file | Crawl access rules |
If you want to noindex a normal web page, use the Meta Robots Tag Generator.
If you want to noindex a PDF or apply a rule across many matching files, use X-Robots-Tag.
Do not confuse either method with robots.txt. A robots.txt disallow controls crawling. A noindex header controls indexing after the crawler can access the response.
How to Noindex a PDF
A PDF has no HTML <head>, so you cannot place a normal robots meta tag inside it.
Instead, configure the server to return:
X-Robots-Tag: noindex
with the PDF response.
You can target one PDF, one directory of PDFs or every PDF on the site.
This is useful for documents that need to remain publicly accessible but should not appear as standalone search results.
Examples might include downloadable print versions, duplicate reports or files intended only for users who reach them through another page.
Do not block the PDF in robots.txt if the search engine needs to crawl it and read the noindex response header.
Noindex vs Nofollow
noindex tells a supporting search engine not to index the URL.
nofollow tells it not to follow links associated with the resource or page.
They solve different problems.
If your only goal is removing a resource from search, noindex is usually the relevant directive.
Do not automatically add nofollow to every noindexed URL. A noindexed HTML document can still contain useful links that you may want crawlers to discover.
For many non-HTML files, nofollow may have little practical value because the file may not function like a normal linked HTML page.
What Does nosnippet Do?
nosnippet prevents Google from showing a text snippet or video preview for the URL in search results.
It is stronger than simply changing a meta description.
A meta description is content Google may choose for a snippet. The nosnippet directive restricts whether a snippet can be shown at all.
Use this only when you intentionally want to limit how content appears in search.
If your goal is simply to prevent indexing, use noindex.
What Is max-snippet?
max-snippet limits the number of characters Google may show as a text snippet.
For example:
max-snippet: 160
sets a maximum snippet length.
A value of 0 acts like nosnippet, while -1 means no explicit maximum.
This is a search-presentation control, not a guaranteed description length. Google still determines the exact snippet based on the query and available content.
What Is max-image-preview?
max-image-preview controls the permitted size of image previews for a page.
Typical values include:
- none
- standard
- large
If visual search presentation matters, restricting image previews may reduce the visual footprint of your result.
Do not select a restrictive value just because it exists. Use it only when your content policy requires it.
What Is unavailable_after?
unavailable_after tells Google not to show a URL in search results after a specified date and time.
This can be useful for resources with a real expiration point, such as:
- Event documents
- Short-term offers
- Time-limited listings
- Temporary reports
- Expired registration materials
Do not use it as a general freshness signal.
A page or file does not need to disappear from search simply because it is old. Use unavailable_after only when the content genuinely should stop appearing after a deadline.
Bot-Specific X-Robots-Tag Rules
X-Robots-Tag can optionally target a specific crawler token. Use bot-specific rules only when the policy genuinely differs by crawler; otherwise a generic header is simpler to audit.
Multiple X-Robots-Tag Headers
A response can contain more than one X-Robots-Tag header.
It can also contain multiple directives in one header.
Search engines can combine applicable rules, and restrictive directives can take precedence when instructions conflict.
For example, accidentally returning one header that permits normal indexing and another that includes noindex can still result in the URL being excluded.
This commonly happens when rules are added at several layers, such as the origin server, CMS, CDN or edge configuration. Inspect the final live response to find the real result.
How to Verify an X-Robots-Tag
Do not stop after copying the generated configuration.
Request the live URL and inspect its HTTP response headers.
You should see something similar to:
X-Robots-Tag: noindex
Confirm that:
- The correct URL returns the header.
- URLs outside the intended scope do not receive it.
- No second configuration adds conflicting directives.
- The crawler is allowed to request the URL if it needs to read noindex.
- CDN caching has not preserved an older response.
Verification is especially important after deploying regex or directory-wide rules.
X-Robots-Tag and robots.txt
A common technical SEO mistake is combining a robots.txt block with noindex and expecting both to work together.
For a search engine to process an X-Robots-Tag noindex directive, it must request the URL and receive the HTTP response.
If robots.txt prevents that crawl, the crawler may not see the header.
If your goal is removal from search while keeping the resource publicly accessible, allow crawling and return noindex.
Use robots.txt when your primary goal is crawl management — see the AI Crawler Robots.txt Generator.
Use X-Robots-Tag when your goal is indexing or search-presentation control.
Common X-Robots-Tag Mistakes
The biggest mistake is applying a broad rule to more files than intended.
Other common problems include:
- Blocking the same URL in robots.txt before noindex can be read
- Adding headers only to HTML error responses instead of the real file
- Forgetting CDN or proxy configuration
- Returning conflicting X-Robots-Tag headers
- Using a file-extension regex that matches unintended URLs
- Assuming a server config change is live without checking the response
- Leaving unavailable_after rules active after a campaign changes
Generate narrowly, deploy carefully and verify the actual header. For canonicalizing duplicate URLs alongside these rules, see the Canonical Tag Generator.