What robots.txt is
robots.txt is a plain text file that tells search engine crawlers which parts of your website they may visit. Well-behaved crawlers such as Googlebot and Bingbot read it before they crawl, and follow it. It is a request, not a lock: it does not hide anything from people, and a bad bot can ignore it.
Where it lives
The file must sit in the root of the domain and be named exactly robots.txt, in lowercase, for example https://example.com/robots.txt. A file in a folder, such as /blog/robots.txt, is not read. Each host needs its own file: blog.example.com does not use the file from example.com.
Syntax: User-agent, Allow, Disallow, Sitemap
The file is made of groups. Each group starts with a User-agent line, followed by rules for that crawler.
- User-agent names the crawler, or
*for all of them. - Disallow gives a path the crawler should not fetch. An empty
Disallow:blocks nothing. - Allow makes an exception inside a blocked path.
- Sitemap gives the full URL of your sitemap. It stands alone and is not tied to a group.
Two wildcards work in paths. * matches any run of characters, and $ marks the end of a URL. For example, Disallow: /*.pdf$ blocks every URL that ends in .pdf. Paths are case sensitive, so /Photos/ and /photos/ are different. When two rules match, Google uses the most specific (longest) one.
User-agent: * Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php Sitemap: https://example.com/sitemap.xml
Robots.txt blocks crawling, not indexing
This is the most misunderstood point. If a page is blocked in robots.txt, Google cannot read it, but it can still list the bare URL in results if other sites link to it. To keep a page out of search results, leave it crawlable and add a noindex meta tag: <meta name="robots" content="noindex">.
Do not combine the two. If you noindex a page and also block it in robots.txt, Google never fetches the page, so it never sees the noindex tag.
The same goes for the AI preset above. Blocking GPTBot, Google-Extended or CCBot asks those crawlers not to use your content for AI training. It does not remove your site from Google Search, because Googlebot is a different crawler.
Common mistakes
- Blocking CSS and JavaScript. Google needs them to render your pages. Do not block folders that hold your styles and scripts.
- Leaving
Disallow: /on after launch. Staging sites are often blocked, and the file gets copied to the live site. Check/robots.txton launch day. - Wrong case.
/Admin/does not block/admin/. - Missing the leading slash. Paths start with
/(or*). The generator warns you if they do not. - Using it for secrets. The file is public. Anyone can read it, so never list private URLs there. Use a password or login instead.
Testing your robots.txt
Open https://example.com/robots.txt in a browser first. It should show plain text. Then use the robots.txt report in Google Search Console (under Settings). It shows the file Google last fetched, when it fetched it, and any errors or warnings. After a change, you can ask Google to recrawl the file from that report.
The WordPress virtual robots.txt
If there is no physical robots.txt in your WordPress folder, WordPress answers requests for /robots.txt with a virtual file it builds on the fly. By default it blocks /wp-admin/ and allows admin-ajax.php, which is what the WordPress preset above produces. SEO plugins can edit this virtual file. If you upload a real robots.txt, the real file wins. Also check Settings, then Reading: the "Discourage search engines from indexing this site" box should be off on a live site.
Blogger
Blogger makes a robots.txt for you. In Settings you can turn on "Custom robots.txt" and paste your own text there. Use full https:// sitemap URLs, and keep it short.
Uploading it on RapidServer
On RapidServer web hosting (cPanel hosting, from ₹49/mo (3-year plan) plus 18% GST) you can upload or edit robots.txt with the cPanel File Manager. Put it in your site's document root, usually public_html. Running a blog? WordPress hosting comes with WordPress pre-installed, and WordPress serves its own robots.txt that SEO plugins can edit. More free tools are on the calculators page.
cPanel web hosting on LiteSpeed and NVMe in Mumbai, with free SSL and a 7-day money-back guarantee.
See web hosting