What does a robots.txt look like?
A file is made of groups. Each group names a crawler with User-agent, then lists Allow and Disallow rules. Anything you do not disallow is allowed by default [2]. An optional Sitemap line can appear any number of times [2].
User-agent: *
Disallow: /cart/
Disallow: /thank-you/
Allow: /
Sitemap: https://www.example.com.sg/sitemap.xml
Here every crawler may visit the whole site except the cart and thank-you pages. The Sitemap value must be a full address [2]. Rules are case-sensitive, so /Cart/ and /cart/ are different paths [2].
Where do I put robots.txt and what can go wrong with it?
The file must be named robots.txt and sit at the root of the host it controls, so https://www.example.com/robots.txt controls www.example.com [2]. It does not cover subdomains such as m.example.com or the http:// version of the same site [2]. A site can have only one file [2].
Write it in a plain text editor, not a word processor. Word processors can add odd characters, such as curly quotes, that crawlers have trouble with [2]. Google says that on a CMS such as Wix or Blogger you might not be able to edit the file directly, and the CMS might offer a search settings page instead [1].
Can robots.txt hide a page from Google?
No. If other pages link to a blocked page with descriptive text, Google could still index the URL without visiting it [1]. The result then shows without a description [1]. A blocked page can still be listed. If a page must not appear, use noindex or password protection instead [1]. Treat a Disallow line as a traffic control for crawlers, never as a privacy setting.
How do I test and upload my robots.txt?
- Create the file Save it as UTF-8 plain text named robots.txt [2].
- Add rules One User-agent group per crawler, or * for all of them [2].
- Upload it to the root Use your host's file manager or deploy it with your site. See web hosting.
- Open it in a browser Visit /robots.txt on your domain and confirm the text loads, then check key pages in Google Search Console.
Questions people ask
Is robots.txt the same as noindex?
No. Robots.txt controls whether a crawler may visit a URL. Noindex controls whether a page may appear in search. Google says robots.txt is not a way to keep a page out of Google [1].
Do I need a robots.txt file?
Not always. Without one, all files are implicitly allowed for crawling [2]. You add one to block certain paths, such as a cart, or to point crawlers to your sitemap [2].
Can bad bots ignore robots.txt?
Yes. The standard describes the rules as requests that crawlers are asked to honour, and not a form of access authorization [3]. Anything private needs a login.
Pages that link here
301 redirect, AI Overviews, Canonical tag, Crawling, Favicon, Google Search Console, Indexing, llms.txt, noindex, Title tag, XML sitemap
Blog posts that use this term
See also
- XML sitemap An XML sitemap is a file on your website that lists the pages you want search engines to find, usually at /sitemap.xml.
- noindex Noindex is a rule, set in a meta tag or an HTTP header, that tells search engines not to show a page in their results.
- Crawling Crawling is when Google's automated programs find your web pages and download their text, images and videos so they can be processed for search.
- Indexing Indexing is when Google analyses a page it has crawled and stores the result in its index, so the page can be shown for matching searches.
- Google Search Console Google Search Console is a free tool from Google that shows how your website performs in Google Search and which pages Google has trouble reading.
- Canonical tag A canonical tag is a line of HTML that tells search engines which URL is the main version when several URLs show the same page.
References
- Introduction to robots.txt, Google Search Central. Read 27/11/2026.
This is used mainly to avoid overloading your site with requests; it is not a mechanism for keeping a web page out of Google.
- How to write and submit a robots.txt file, Google Search Central. Read 27/11/2026.
The robots.txt file must be located at the root of the site host to which it applies.
- RFC 9309: Robots Exclusion Protocol, IETF. Read 27/11/2026.
These rules are not a form of access authorization.