What Is Robots.txt and Do I Need One?
Robots.txt tells search engine crawlers which parts of your site to avoid. Learn what it does, a safe basic example, and the costly mistakes to watch for.

Short answer: Robots.txt is a small text file at yoursite.com/robots.txt that tells search engine crawlers which parts of your website they may or may not crawl. Most small business websites only need a very simple one, or can even work fine without one, but a single wrong line can hide your entire site from Google, so it is worth checking.
Robots.txt is one of the oldest standards on the web, and also one of the most misunderstood. People think it hides pages from Google (it does not, reliably), think it protects private content (it definitely does not), and occasionally block their whole site without realising. Here is what you actually need to know.
What robots.txt does, and does not do
When a well-behaved crawler such as Googlebot or Bingbot visits your site, it checks robots.txt first and follows the rules it finds. The file controls crawling: whether bots may fetch a URL. It does not directly control indexing: whether a URL appears in search results.
That distinction matters. If you block a page in robots.txt but other sites link to it, Google can still list the URL in results, usually with no description, because it knows the page exists but cannot read it. To keep a page out of search results, you need a noindex meta tag or header, and the page must not be blocked in robots.txt, otherwise Google never sees the noindex instruction. This is the single most common technical mistake we see around robots.txt.
| Goal | Right tool | Wrong tool |
|---|---|---|
| Stop a page appearing in Google | noindex meta tag | robots.txt Disallow |
| Stop bots wasting time on endless filter URLs | robots.txt Disallow | noindex on thousands of pages |
| Protect private or sensitive content | Password protection or login | robots.txt (it is public) |
| Remove a page urgently | Search Console Removals tool plus noindex or deletion | robots.txt alone |
And remember: robots.txt is a public file anyone can read. Listing "/secret-admin-panel/" in it is like putting a sign on a door saying "valuables here". Also, bad bots simply ignore it.
What a robots.txt file looks like
A sensible file for a typical small business site:
User-agent: *
Disallow:
Sitemap: https://www.example.com/sitemap.xml
This says: all crawlers (*) may crawl everything (an empty Disallow), and here is where the sitemap lives. That is genuinely all most small business sites need.
A WordPress site often has something like:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://www.example.com/sitemap_index.xml
The key directives explained
- User-agent: which crawler the rules apply to.
*means all. You can target specific bots, for exampleGooglebot. - Disallow: a path the crawler should not fetch.
Disallow: /blocks everything. - Allow: an exception to a Disallow rule. Supported by Google and Bing.
- Sitemap: the full URL of your XML sitemap. See what is an XML sitemap.
- Crawl-delay: asks bots to slow down. Google ignores it; some other crawlers respect it.
Paths are case-sensitive, and Google supports * as a wildcard and $ to mark the end of a URL. For example Disallow: /*?sort= blocks any URL containing a sort parameter.
The one line that can wipe you off Google
This is the dangerous one:
User-agent: *
Disallow: /
It tells every crawler not to fetch any page. Developers often use it on staging sites while building, and then forget to remove it at launch. The live site goes up, looks perfect, and Google is politely told to stay away. Over time pages drop out of results or never appear. If your new site is not showing on Google, check this first. See why is my website not showing on Google.
Not sure if Google can see your site?
Our Website Rescue service checks robots.txt, noindex tags, sitemaps and speed, then fixes what is blocking you.
A worked example: the vanishing roofer
Imagine a roofing company in Cardiff that had its site redesigned. The old site ranked well for several local searches. Three weeks after the new site launched, calls from Google dried up.
A look at /robots.txt shows Disallow: /, carried over from the developer's test environment. Search Console's robots.txt report confirms Google has fetched the blocking version. The fix takes thirty seconds: change it to an empty Disallow and add the sitemap line. Then in Search Console, the owner requests indexing for the homepage and key service pages and resubmits the sitemap. Rankings recover over the following weeks, although the lost enquiries in the meantime were real money.
The lesson: robots.txt should be on every website launch checklist. See our website launch checklist.
When small businesses actually need custom rules
Most do not. But custom rules make sense when:
- Your shop generates endless filter URLs (colour, size, sort order) that waste crawl attention. Blocking parameter patterns can help.
- Internal search results pages are being crawled. Google recommends against letting these be crawled.
- You have a large site where crawl budget genuinely matters. For a 20-page business site, crawl budget is not something to worry about.
How Google handles errors in the file
A few lesser-known behaviours worth knowing. If Google cannot fetch robots.txt because your server returns an error (a 5xx response), it may temporarily treat the whole site as blocked and slow crawling until the file is reachable again. If the file simply does not exist and returns a 404, Google assumes there are no restrictions and crawls normally. Google also caches robots.txt, typically for up to a day, so fixes are not always picked up instantly. You can ask for a recrawl from the robots.txt report in Search Console. Finally, the rule matching uses the most specific path: if one line disallows /services/ and another allows /services/roofing, the more specific Allow wins for that page.
Robots.txt and AI crawlers
A newer question: should you block AI crawlers? Several AI companies publish user-agent names for their crawlers, such as GPTBot from OpenAI, and the Google-Extended token that controls whether content is used for some Google AI models. You can block these with robots.txt rules. The trade-off: blocking may reduce the chance your content is used or cited by those AI tools, which matters as more people search through AI assistants. For most local businesses that want to be found, we lean towards allowing them. Read how to rank in AI search for more. This is a fast-changing area, so check each provider's current documentation.
Mistakes to avoid
- Leaving
Disallow: /on after launch. The classic. - Blocking CSS and JavaScript files. Google needs them to render and understand your pages. Old advice to block them is out of date.
- Using robots.txt to hide pages from results. Use noindex instead.
- Blocking a page that has a noindex tag. Google cannot see the tag, so the page may stay in results.
- Listing sensitive paths. The file is public.
- Typos and wrong case.
/Blog/and/blog/are different paths. - Putting the file in the wrong place. It must be at the root, for example example.com/robots.txt, and each subdomain needs its own.
How to check your robots.txt
- Visit
yoursite.com/robots.txtin your browser. - Look for
Disallow: /underUser-agent: *. If present and your site should be public, fix it now. - Check there is a
Sitemap:line with the correct full URL. - In Google Search Console, open the robots.txt report (under Settings) to see what Google fetched and any errors.
- Use URL Inspection on a key page to confirm "Crawl allowed: Yes".
Our take
For most small businesses, the best robots.txt is a boring one: allow everything, point to the sitemap, done. The danger is not in what you fail to add, it is in leftover lines that block Google without anyone noticing. Check it after every launch, redesign or platform move.
On SiteDrum sites, robots.txt is set correctly at launch, points to an auto-updated sitemap, and never blocks the CSS or scripts Google needs. If you are on a builder like Squarespace or Shopify, you usually cannot or do not need to edit it much, and the defaults are generally sensible. If your current site has vanished from Google after a redesign, that is precisely the kind of problem Website Rescue is for.
Quick checklist
- Open yoursite.com/robots.txt.
- Make sure there is no site-wide
Disallow: /. - Do not block CSS, JavaScript or image folders Google needs.
- Add your sitemap URL.
- Use noindex, not robots.txt, to keep pages out of results.
- Check the robots.txt report in Search Console.
- Recheck after every redesign or migration.
The bottom line
Robots.txt tells search engine crawlers where they may go on your site. Most small businesses need only a simple file that allows everything and points to the sitemap. It does not hide pages or protect content, but one wrong line can block Google entirely, so check it whenever your site changes.
Frequently asked questions
Do I need a robots.txt file?
It is not strictly required. If there is no file, crawlers assume they can crawl everything. Having a simple one that allows all crawling and lists your sitemap is good practice, and most platforms create one automatically.
Does robots.txt stop pages appearing in Google?
Not reliably. It stops crawling, but Google can still list a blocked URL if other sites link to it. To keep a page out of results, use a noindex tag and make sure the page is not blocked in robots.txt so Google can see that tag.
Can robots.txt protect private pages?
No. The file is public and only well-behaved bots follow it. Anything private should be behind a password or login, and listing sensitive paths in robots.txt can actually draw attention to them.
How do I edit my robots.txt file?
On WordPress, SEO plugins usually let you edit it in the settings. On static or custom sites it is a text file in the root folder. Builders like Wix, Squarespace and Shopify offer varying levels of control, so check their help pages.
Should I block AI crawlers in robots.txt?
You can, using the user-agent names each AI company publishes. Blocking may reduce the chance your content is used or cited by those AI tools. Most local businesses that want maximum visibility choose to allow them, but it is a business decision and the landscape is changing quickly.
Want a website that brings you customers?
Tell us what you do on WhatsApp and we will send a fixed quote and a free mockup.
Get my free mockupRelated guides
Our products
Website design near you
Website design in LondonWebsite design in New YorkWebsite design in TorontoWebsite design in EdinburghWebsite design in PhoenixWebsite design in DublinWebsite design in AntwerpWebsite design in MiamiWebsite design in BergenWebsite design in SydneyAll cities →
SiteDrum home · All guides · Sitemap · Contact us
More google guides
- How Long Does SEO Take to Work?
- Is SEO Worth It for a Small Business?
- What Is a Google Penalty and How Do I Recover?
- How Do I Get Listed on Bing Places and Apple Business Connect?
- How Do I Track My Google Rankings for Free?
- Local SEO for Small Business: The Complete 2026 Guide
- How to Optimise Your Google Business Profile (and Get More Calls)
- How to Get More Google Reviews for Your Small Business