Skip to content
Enjoy 20% off for 12 months on all plans. Use promo code: HYPERGROWTHClaim it

X-Robots-Tag: How to Check, Set, and Fix It (2026)

By Toy Wen Da, Co-Founder · Updated · 7 min read · scored 91/100

An X-Robots-Tag is an HTTP response header that tells search engines whether to index or follow a page or file. Because it travels in the server's response rather than in the HTML, it works on PDFs, images and any other file type. To change one, edit your server config or your CMS header settings, then confirm the result by checking the live response.

Before you change anything, look at what your site is sending now. The free meta tag checker pulls the live response headers and meta tags for any URL, so in one pass you can see whether an X-Robots-Tag is present, which directive it carries, and whether it conflicts with a meta robots tag on the same page.

What an X-Robots-Tag does

The tag carries one or more comma-separated directives in the HTTP response. Search engines read them the same way they read a meta robots tag, but since the instruction sits in the header, it applies to any file the server serves, not just HTML pages.

You cannot put a meta tag inside a PDF or a JPEG, so if you need to keep a downloadable file or an image out of search results, the X-Robots-Tag is your only option.

The directives you'll use most

Directive What it does Typical use case
noindex Keeps the page or file out of search results Internal reports, staging pages, duplicate PDFs
nofollow Tells crawlers not to follow links on that URL Pages with outbound links you don't want to pass authority
noarchive Stops Google from showing a cached copy Pages with time-sensitive pricing or content
nosnippet Blocks a text or image preview in results Content you don't want excerpted in the SERP
unavailable_after Removes the page from results after a set date Limited-time offers, expired listings

How to set it on your own site

Detailed view of a toy robot holding a metallic screw, surrounded by tools.

The steps depend on your server, but the pattern is the same everywhere: add the header at the server level, then verify it on the live URL.

On Apache (.htaccess)

  1. Open your site's .htaccess file.
  2. Target the file type you want to control, for example PDFs:
    <Files ~ "\.pdf$">
    Header set X-Robots-Tag "noindex, nofollow"
    </Files>
    
  3. Save and upload the file to your server's root directory.
  4. Reload the affected URL and confirm the header shows up in the response.

On Nginx

  1. Open your server block configuration.
  2. Add a location rule for the file type, for example images:
    location ~* \.(png|jpe?g|gif)$ {
      add_header X-Robots-Tag "noindex";
    }
    
  3. Reload Nginx so the config takes effect.

On WordPress or a managed CMS

Most CMS platforms handle meta robots tags through an SEO plugin's page-level settings, which is simpler for ordinary pages and posts. Reach for the X-Robots-Tag when you need to block PDFs, downloads or other non-HTML files that a plugin can't touch. If your CMS doesn't expose header controls, you'll usually need to edit the server config through your host's file manager or ask your developer to add the rule.

Before and after any change, confirm your robots.txt file isn't blocking the same URL, because crawlers that can't reach a page never see the directive inside it. Run the URL through a robots.txt tester to rule that out. If you need to rebuild the file from scratch, a robots.txt generator will produce a valid one without the syntax mistakes that cause accidental site-wide blocks.

Robots.txt, meta robots or X-Robots-Tag?

These three tools sound alike and get confused constantly, but each solves a different problem.

Tool Where it lives Controls Best for
Robots.txt Root-level text file What crawlers can access Blocking crawl of entire folders or sections
Meta robots tag Inside the HTML <head> Indexing of one HTML page Simple, page-by-page control on standard pages
X-Robots-Tag HTTP response header Indexing of any file type PDFs, images, large batches of URLs by pattern

Robots.txt governs crawling, while the other two govern indexing. A page can be crawlable and still be kept out of results with noindex. A page blocked from crawling, on the other hand, never has its indexing instruction read at all.

When your own tools are enough, and when they aren't

A free header checker is enough for a single URL: you've just made a change and want to confirm it took effect, or someone reports one page showing up in search that shouldn't be there. The free meta tag checker handles that in seconds.

It stops being enough once the problem spans your whole site, such as a server migration that wiped your header rules, a CDN config pushed to every file type, or a WordPress plugin update that silently changed default behavior. Then you're trying to find which of hundreds or thousands of pages picked up an unwanted noindex, and a recurring technical audit does that better than a manual spot-check, since a one-time look won't catch a regression that happens next month.

Common mistakes

  • Setting noindex in both robots.txt and the X-Robots-Tag. If robots.txt blocks the URL, Google never reads the header, so the indexing directive sits unused.
  • Applying the header to an entire file type when only some files need it. A blanket PDF rule can accidentally deindex documents you wanted found.
  • Forgetting to check after a server migration. New hosting environments often strip custom header rules without warning.
  • Confusing nofollow on the page with rel="nofollow" on a link. The first is page-wide and the second is link-specific.
  • Assuming a plugin setting covers non-HTML files. Most SEO plugins only touch meta tags on pages and posts, not PDFs or images served directly.

FAQs

Does the X-Robots-Tag work the same as a meta robots tag?

They accept the same directives, but the X-Robots-Tag is an HTTP header set at the server level, while the meta robots tag is HTML markup inside a page's <head>. The header also works on non-HTML files, which meta tags cannot touch.

Can I use the X-Robots-Tag and robots.txt together?

Yes, but only if robots.txt still allows crawling of the URL. If the page is disallowed there, crawlers never reach it to read the X-Robots-Tag directive.

How do I check if a page has an X-Robots-Tag?

View the HTTP response headers for that URL. Browser developer tools, a header-inspection browser extension or a dedicated checker will each show the raw response, and any X-Robots-Tag directive will be in it.

Will adding noindex remove a page from Google immediately?

No. Google has to recrawl the URL and process the directive before the page drops out of results, which can take anywhere from a few days to a few weeks depending on how often the page is crawled.

What happens if I set conflicting directives on the same page?

Search engines generally apply the more restrictive directive when conflicts arise, but relying on that is risky. Clean up conflicting rules rather than assuming the stricter one always wins.

Get a full read on your site's indexing signals

A one-off check tells you about a single URL; it won't tell you whether the same misconfiguration is quietly repeating across your site. If you want a full picture of how your pages are indexed, crawled and served, X-Robots-Tag included, talk to the team and get a sample report built from your own site's data.

See what this looks like on your own siteEnter your website. You get the searches your buyers make and the page that should answer each one.

Sources

About the author

SearchBlueprint researched, wrote and scored this article with the content pipeline our customers run on their own sites. The score in the byline is what our content engine gave this page before it published. Nothing here is reviewed by hand, which is the point: it is the product's output, published where anyone can check it.