07887 423199me@richieaubin.com

Apply noindex to HTML pages and files

Use noindex when a public page should remain available to visitors but should not appear in search on engines that support the directive. The crawler needs access to the response to read it.

Noindex implementation example
Example image · CC0 1.0 licence

Choose a way to do this check

Check pasted HTML

  1. Paste the public page source or its head and enter the page URL.
  2. Find the robots tag and then check X-Robots-Tag separately in response headers.

Screaming Frog

  1. Filter Directives for noindex and open a representative affected URL.
  2. Export the affected URLs and include an unaffected template as a control.

Search Console URL Inspection

  1. Compare stored inspection with the current live test after a change.
  2. Remember that a crawl block can prevent Google from reading a live noindex.
Example markup inspection: the pasted HTML has a self-referencing canonical and a separate noindex instruction.
Example markup inspection: the pasted HTML has a self-referencing canonical and a separate noindex instruction.

1. Define precisely what should be excluded

Choose the exact page, file or template state. Compare a URL you want excluded with a similar URL that must remain searchable. Confirm that a redirect, permanent removal or access restriction would not better match the outcome. If the content itself is sensitive, protect access to it rather than waiting for a search directive to take effect.

2. Add the directive to HTML

Use a robots meta tag in the head of the HTML served for the chosen URL. If the site already emits robots directives, check for duplicates and conflicting template settings. Prefer a server-side publishing setting so the original response contains the instruction without requiring JavaScript.

Public HTML page · inside head
<meta name="robots" content="noindex">

Do not add the page to a canonical XML sitemap after making this change. If a crawler is blocked from loading the page by robots.txt, it may not see the meta tag. Test both crawl access and the live HTML. Compare the original response with the rendered page if scripts can modify the head.

3. Set an HTTP header for a file

A PDF has no HTML head. Set X-Robots-Tag on the PDF response itself. The example below is a document-root Apache configuration using mod_headers. It matches a single filename within that configuration scope. If the same filename exists in multiple directories, use more specific configuration scoped to the intended file.

Apache 2.4 · .htaccess for the relevant directory
<Files "printable-guide.pdf">
    Header set X-Robots-Tag "noindex"
</Files>

Confirm that the server permits the directive in this context. On a site behind a CDN, check the response people receive from the public edge. An origin-level header can be overwritten or missing on a cached response.

4. Verify the intended and unaffected URLs

Use these two requests to check the actual result. The HTML page should contain the meta tag and the PDF should return the header. Replace the illustrative routes. Check that comparable indexable routes are free of the exclusion.

Terminal · see both forms of noindex
curl -fsS https://www.example.com/confirmation/ \
  | grep -i 'name="robots"'
curl -sS -D - -o /dev/null \
  https://www.example.com/printable-guide.pdf \
  | grep -Ei '^(HTTP/|Content-Type:|X-Robots-Tag:)'

Inspect the URL in Search Console when using this procedure for Google. A successful live check confirms the directive is present now. It does not confirm Google's stored index record has already changed. Keep a dated record of the change and check again after recrawling. If a template excluded too many pages, restore the previous template and verify the live controls before asking for reprocessing.

Technical references

Frequently asked questions

Can I combine noindex with a robots.txt block?

Keep the URL crawlable when you rely on Google reading noindex. If a crawl block prevents access, it also prevents seeing the directive.

Should I put noindex in robots.txt?

Google does not support that rule in robots.txt. Use a meta tag or HTTP header.

Does noindex work for PDFs?

Use X-Robots-Tag on the actual file response for engines that support it.

How quickly will the listing disappear?

Timing depends on recrawling and processing. Verify the live setting first and monitor the stored report separately.

Written by Richie Aubin

Published