Technical SEO
Robots.txt vs Noindex: Which One Should You Use?
Choose the correct control for crawling, search visibility and private pages, with a staging-site example.
Decide what needs to be restricted
Use robots.txt to communicate crawl rules to compliant bots. Use a noindex directive for accessible content you want Google to exclude from search. Use authentication for a private area. Google needs to fetch a page or response header to see noindex, so a disallow rule can prevent that directive from being read.
Do not treat robots.txt as access control. It is publicly readable and it identifies the paths you list. A blocked URL can sometimes be discovered through links and appear without a snippet. Files containing customer information or unreleased product details should sit behind access controls.
Pick the right rule for the job
Suppose a staging copy is visible on a public subdomain. Put the whole staging environment behind authentication before inviting people to test it. Separately check that the production website does not inherit staging rules during deployment. If an old printable guide must remain public but you prefer it out of search, serve noindex on that URL and allow Google to read it.
For a PDF, a server can send an X-Robots-Tag header where an HTML meta tag is unavailable. Verify the final URL's response headers. A directive on a redirecting URL does not replace checking the destination. Remove excluded URLs from the sitemap and keep the public equivalents easy to navigate.
Test the release by URL
Open robots.txt on the correct host and identify the group that applies to the crawler you care about. Look for a path rule that unexpectedly covers a public directory. Inspect the HTML and HTTP headers of a representative URL. Use Search Console for a live test of URLs you manage and allow time for changes to be processed.
Check the difference on PDF and HTML pages
Fetch the published PDF and inspect the response headers. When the same material is available as an article and a printable file, decide which format people should find in search. If the printable copy must be excluded, confirm that an intermediary such as a CDN still forwards the noindex header. A successful check on the HTML version says nothing about the policy on the PDF response.
Frequently asked questions
Will robots.txt remove an indexed page immediately?
No. The crawl rule controls access. For a public page you want excluded, make the noindex directive readable or serve the appropriate removed-page response.
Can I use noindex inside robots.txt?
Google does not support noindex in robots.txt. Use the HTML meta tag or the HTTP response header.
How do I recover after deploying a staging noindex to production?
Remove the staging directive, verify the live production response and request reprocessing for important pages.