Technical SEO

What is Robots.txt

A root-level file that tells crawlers which URLs they may or may not fetch.

Overview

Robots.txt is a plain-text file at the root of a domain that gives crawling instructions to bots via allow and disallow rules. It controls what search engines are permitted to crawl, and it is the first file most crawlers request. It is a crawling directive, not an indexing one.

A critical distinction: disallowing a URL stops Google fetching its content, but the URL can still be indexed (without a snippet) if it is linked from elsewhere. To keep a page out of the index, use a noindex tag, which requires the page to be crawlable.

Why it matters

A single wrong line can be catastrophic. Disallow: / blocks the entire site from crawling, which is a classic launch-day disaster when a staging rule ships to production. Robots.txt is powerful precisely because it is applied site-wide.

Common mistakes

Using robots.txt to try to hide a page from search (use noindex instead), blocking CSS or JS that Google needs to render the page, or leaving a staging Disallow: / rule live after go-live.

  • Do not block resources needed for rendering
  • Do not rely on it to deindex pages
  • Reference your sitemap with a Sitemap: line

Why it matters

robots.txt is the first file Googlebot requests on any site, and a single wrong line can be catastrophic — a stray `Disallow: /` pushed to production has taken major sites out of Google entirely. It is a crawl-control tool, not an index-control tool, and confusing the two is the most common and damaging mistake. Used well, it conserves crawl budget and keeps bots out of admin, search-result and infinite URL spaces; used carelessly, it silently blocks the pages you most want ranked.

  • The first file every crawler checks — errors here affect the whole site
  • Controls crawling, not indexing — a blocked URL can still appear in results
  • A wrong Disallow can de-rank an entire site, so it needs careful review

Common mistakes and the noindex trap

The classic error is using robots.txt to try to remove a page from Google. Because a disallowed page is never crawled, Google never sees a noindex tag on it — so a page you block in robots.txt AND noindex can stay indexed indefinitely, since the crawler can never read the noindex. To reliably de-index a page you must allow it to be crawled and serve a noindex (or use the removals tool). Also remember robots.txt is public: never rely on it to hide sensitive URLs, since you are literally publishing their paths.

  • To de-index a page, do NOT block it in robots.txt — it must be crawlable to read the noindex
  • Blocking CSS/JS can break rendering and hurt how Google sees the page
  • robots.txt is publicly readable — never use it as a security measure

In practice

A SaaS company launches a redesign and organic traffic collapses overnight. The cause is a single line — `Disallow: /` — carried over from the staging robots.txt and pushed live, blocking Googlebot from the entire site. Because the pages were still indexed but now uncrawlable, they began dropping out of results as Google refreshed. The immediate fix is to correct robots.txt to allow crawling, then use URL Inspection to request re-crawling of key pages. The broader lesson: robots.txt is the highest-blast-radius file on a site, so it belongs in code review and deploy checks, staging and production versions must never be confused, and after any deploy the live robots.txt should be verified in Search Console's robots.txt report before you move on.

Common questions

Robots.txt — questions

Straight answers on how this fits your marketing and build.

Can robots.txt remove a page from Google?
No. Blocking a URL stops it being crawled, but a blocked URL can still be indexed without a snippet if it is linked. To deindex, allow crawling and add a noindex tag, or remove the page.
Should I block my CSS and JavaScript?
No. Google needs those files to render and understand the page. Blocking them can make your page look broken to the crawler and hurt how it is assessed and ranked.
Does robots.txt stop a page appearing in Google?
No. It stops the page being crawled, but a disallowed URL can still be indexed (usually as a bare link with no description) if other pages link to it. To keep a page out of the index you need a noindex directive on a crawlable page, not a robots.txt block.
Should I block my staging site with robots.txt?
robots.txt alone is not enough — the URLs are still public and can be discovered and indexed. Protect staging with HTTP authentication (a password), which is the only reliable way to keep it out of Google and away from prying eyes.

Still have questions? Talk to a specialist