I have to add my answer here, as the accepted answer does not really address the issue properly. Also remember that preventing Google from crawling does not mean that you can keep your content private.
My answer is based on several sources: https://developers.google.com/webmasters/control-crawl-index/docs/getting_started https://sites.google.com/site/webmasterhelpforum/en/faq--crawling-- indexing --- ranking
robots.txt file controls the scanning, but not the indexing! These two are completely different actions performed separately. Some pages may be crawled but not indexed, and some may even be indexed but never crawled . A link to a page without crawling may exist on other websites, which will cause the Google indexer to follow it and try to index.
An indexing question that collects page data so it can be accessed through search results. This can be blocked by adding a meta tag:
<meta name="robots" content="noindex" />
or adding an HTTP header in the response:
X-Robots-Tag: noindex
If the question is about scanning, then of course you can create a robots.txt file and put the following lines:
User-agent: * Disallow: /
A crawl is an action performed to collect information about the structure of one particular website. For example. You added a site using Google Webmaster Tools. Crawler will take it to your account and log in to your site looking for robots.txt . If he does not find, then he will assume that he can scan everything (it is very important to have a sitemap.xml file to help with this operation, as well as indicate priorities and determine the frequency of change). If he finds a file, he will follow the rules. After a successful scan, at some point, indexing is done to crawl the pages, but you cannot tell when ...
It is important . This means that your page can still appear in Google search results regardless of robots.txt .
I hope at least some users will read this answer and let it know, because it is important to know what is actually happening.
Karol Feb 11 2018-11-14T00: 00Z
source share