Key Takeaways
- Robots.txt is a small file that tells search engine crawlers which parts of your site they may crawl. It controls crawling, not indexing.
- Blocking a page in robots.txt does not reliably keep it out of Google. Google can still list a blocked address if other pages link to it. Use noindex or a password instead.
- The most damaging mistake is a staging rule that blocks the whole site, carried over to the live site at launch.
- Do not block the CSS and JavaScript files Google needs to see your pages properly.
- Test every change with the robots.txt report in Google Search Console, which replaced the old tester in November 2023.
What Robots.txt Is
Robots.txt is a plain text file that sits at the root of your website, at an address like yourbusiness.com/robots.txt. Before a well-behaved crawler, such as Googlebot, crawls your site, it reads this file to see which areas it may visit.
The file is made of simple rules. Each group starts with the crawler it applies to, then lists paths it may or may not crawl. A very common file looks like this:
User-agent: *Disallow: /wp-admin/Allow: /wp-admin/admin-ajax.phpSitemap: https://yourbusiness.com/sitemap.xml
In plain words: all crawlers may crawl everything except the WordPress admin folder, with one exception inside it, and the sitemap lives at the address listed.
What robots.txt does
- Asks crawlers not to crawl certain folders or files.
- Helps keep crawlers away from areas that waste their time, like internal search results.
- Points crawlers to your sitemap.
What robots.txt does not do
- It does not remove pages from Google's index.
- It does not hide private information. The file itself is public, and it can even point people to the folders you are trying to hide.
- It does not stop bad bots. Rules are a request that respectful crawlers follow. Malicious ones ignore them.
- It does not protect anything with a password.
Why a Tiny File Matters So Much
Most website problems affect one page or one feature. Robots.txt is different. It is read before Google crawls anything, so a single bad line can affect every page at once. That is why it deserves a place on every launch checklist, even though most owners never think about it.
The good news is that the file is short, public and easy to check. Anyone can open it in a browser and read it in a minute. You do not need to be technical to spot the most dangerous mistakes.
The Big Misunderstanding: Crawling Is Not Indexing
This is the mistake behind many robots.txt problems. Crawling means Google visits and reads a page. Indexing means Google adds it to its search results library. Robots.txt only controls the first.
Google's own documentation says robots.txt is not a way to keep a web page out of Google. If other pages link to a blocked address, Google can still index the address itself, without reading the page. It may show up in results with no description, because Google was not allowed to see the content.
How to really keep a page out of Google
- A noindex tag. A line in the page's code that asks search engines not to index it. Google must be able to crawl the page to see this tag, so do not also block it in robots.txt.
- Password protection. For private content, require a login. Google cannot crawl what it cannot open.
- Remove the page. Delete it so it returns a not-found status.
Note that Google stopped supporting a "noindex" rule inside robots.txt files in 2019. Put noindex on the page itself.
Robots.txt, Noindex or Canonical: Which Tool When
Three tools often get mixed up. Each does a different job.
- Robots.txt controls crawling. Use it to keep crawlers out of areas that waste their time or serve no searcher, like internal search results, endless filter combinations or admin areas.
- Noindex controls indexing. Use it on pages that may be crawled but should not appear in results, like thank-you pages or thin archives.
- Canonical tags handle duplicates. Use them when several addresses show the same content and you want Google to treat one as the main version.
A common error is combining them badly, such as blocking a page in robots.txt and also adding noindex. Google cannot crawl the page, so it never sees the noindex. Pick the right tool for the goal.
Each Subdomain Has Its Own File
Robots.txt rules apply only to the exact host where the file lives. The file at yourbusiness.com/robots.txt does not cover shop.yourbusiness.com or book.yourbusiness.com. Each subdomain needs its own file if it needs rules. The same goes for http and https versions, although most sites redirect one to the other.
Mistake 1: Blocking the Whole Site
Two short lines can make your entire site invisible to Google:
User-agent: *Disallow: /
That single slash means "everything." It is common on staging and development sites, where you do not want Google crawling an unfinished copy. The disaster happens when the staging robots.txt is copied to the live site at launch, or a "discourage search engines" setting is left switched on.
Within days, Google stops crawling. Over time, pages can drop out of results or show without descriptions. Many businesses only notice when calls slow down.
How to prevent it
- Put "check robots.txt" at the top of every launch checklist.
- Protect staging sites with a password instead of relying on robots.txt alone.
- After any launch or migration, open yoursite.com/robots.txt yourself and read it.
- Check the robots.txt report in Search Console the same day.
Mistake 2: Blocking CSS and JavaScript
Google does not just read your text. It renders pages, the way a browser does, to see the layout, what loads and whether the page works on phones. To do that, it needs your CSS files, which control the design, and JavaScript files, which run features.
Older advice told site owners to block folders full of these files. Today, blocking them can stop Google from seeing your page the way visitors do. It may misjudge your content or how the page works on phones.
Check that robots.txt does not block theme, plugin, script or style folders that your pages rely on. In URL Inspection, the live test shows any resources Google could not load.
Mistake 3: Blocking Pages You Want to Remove
When owners want an old or embarrassing page gone from Google, they often add it to robots.txt. That can backfire. Google can no longer crawl the page, so it cannot see a noindex tag or notice that the page was deleted. The address may linger in results.
To remove a page, delete it or add noindex, and keep it crawlable until Google drops it. For urgent cases, the Removals tool in Search Console can hide it temporarily while you do that.
Mistake 4: Typos and Wrong Paths
Robots.txt is unforgiving. Small errors change everything:
- Paths are case-sensitive, so /Services/ and /services/ are different.
- A missing slash can block more than you meant. A rule for /blog also matches /blog-archive and /blogging-tips.
- A rule placed under the wrong user-agent group applies to the wrong crawler.
- Fancy quotes or hidden characters from a word processor can break a line.
Edit the file in a plain text editor or your platform's robots.txt setting, and test every change.
Mistake 5: Blocking Important Sections by Accident
A rule meant for one area can catch another. Common examples:
- Blocking a folder that also contains your service pages.
- Blocking all addresses with a question mark, which also blocks some real pages on certain platforms.
- Blocking an images folder, so your photos never appear in Google Images.
- Blocking the language folder for your Spanish pages.
Mistake 6: Using Robots.txt for Security
Some sites list sensitive folders in robots.txt, such as admin areas, backups or private files, believing it hides them. The opposite is true. Robots.txt is public. Anyone can read it, including attackers looking for interesting folders.
Protect sensitive areas with logins and proper server settings. Do not advertise them in a public file.
Mistake 7: An Unreachable Robots.txt
If your robots.txt file returns a server error, Google cannot tell what you allow, so it may pause crawling your site until it can read the file again. A missing file that returns a not-found status is treated very differently: Google assumes there are no restrictions.
Make sure the file loads reliably. Security tools, firewalls and broken hosting setups sometimes block or break it without anyone noticing.
Mistake 8: Blocking Filters the Wrong Way
Online stores and directories often use robots.txt to stop Google from crawling endless filter combinations. That can be smart, because those addresses waste crawling. But rules written too broadly can also block real category pages, or block pages that carry canonical tags Google needs to see.
Work out exactly which address patterns are junk before blocking them. Test sample addresses, both junk and real, in Search Console after the change.
Mistake 9: Forgetting the Sitemap Line, or Pointing to the Wrong One
The Sitemap line in robots.txt helps search engines find your sitemap. After a redesign or platform change, it often still points to an old sitemap that no longer exists or lists outdated addresses. Update it whenever your sitemap address changes, and use the full https address.
Mistake 10: Platform Settings That Rewrite the File
Many platforms manage robots.txt for you. WordPress has a setting that discourages search engines from indexing the site. SEO plugins can edit the file. Website builders generate their own. When several tools try to control the same file, or a setting is left switched on after launch, the result can surprise you.
- On WordPress, check the reading settings to make sure search engines are not discouraged.
- Know which tool controls your robots.txt, and make changes only there.
- After updates to plugins or the platform, glance at the file again.
What a Healthy Robots.txt Looks Like for a Small Business
Most small business sites need very little in robots.txt. A healthy file usually:
- Allows crawling of the whole public site.
- Blocks only true junk or private areas, like admin folders or internal search results.
- Lists the sitemap's full address.
- Has no rules the owner cannot explain.
If your file is long and full of rules nobody remembers adding, that is a reason to review it with your developer. Shorter is usually safer.
A Simple File Most Small Sites Can Use
For a typical small business site, a short file is often all you need. On WordPress, it might allow everything except the admin area and list the sitemap, like the example near the top of this guide. On other platforms, it may simply list the sitemap.
Do not copy a long robots.txt file from another website or a template. Rules that made sense for a large store or a news site can block things your site needs. Start short, and add a rule only when you have a clear reason.
Robots.txt on Common Platforms
WordPress
WordPress creates a basic virtual robots.txt file if you do not upload one. SEO plugins often let you edit it from the dashboard. A physical file uploaded to the server takes over from the virtual one, which can confuse people when edits in the plugin seem to do nothing.
Wix, Squarespace and Shopify
Hosted platforms generate robots.txt for you. Some allow edits through their settings. Check the platform's help center before changing anything, and remember that platform updates may change the defaults.
Custom-built sites
Your developer controls the file directly. Make sure the live and staging versions are kept separate in the deployment process, so one never overwrites the other.
Keep a Change Log
Robots.txt mistakes are easy to make and hard to trace later. Keep a short note each time the file changes: the date, who changed it, what changed and why. If traffic drops, you can quickly see whether a robots.txt change happened around the same time.
Reading a Robots.txt File, Line by Line
- User-agent: which crawler the next rules apply to. An asterisk means every crawler.
- Disallow: a path that crawler should not crawl. An empty Disallow means nothing is blocked.
- Allow: an exception inside a blocked area.
- Sitemap: the address of your XML sitemap.
- Lines starting with #: comments for humans, ignored by crawlers.
When rules conflict, Google follows the most specific matching rule for its crawler. If a crawler has its own group, it follows that group instead of the general one.
Wildcards and Special Characters
Google supports two special characters in robots.txt rules. An asterisk matches any sequence of characters, and a dollar sign marks the end of an address. They are powerful and easy to misuse.
- A rule like
Disallow: /*?blocks every address containing a question mark, which can include real pages on some platforms. - A rule like
Disallow: /*.pdf$blocks addresses ending in .pdf, which might hide useful documents such as menus or brochures.
Use these only when you understand exactly which addresses they match, and test a few real addresses afterward.
Staging Sites Done Right
Staging sites, the private copies where changes are built and tested, are where many robots.txt mistakes start. The safest approach:
- Protect the staging site with a password, so neither people nor crawlers can see it.
- Use a robots.txt that blocks everything on staging as a second layer.
- Make sure the live site has its own correct robots.txt, not a copy of staging's.
- After every deployment from staging to live, check the live robots.txt and any search engine visibility settings.
Bad Bots Need a Different Tool
If your server is being hammered by scrapers or bad bots, robots.txt will not help much, because those bots ignore it. Use your hosting's firewall, a security service or rate limiting to block abusive traffic. Be careful that those tools do not block Googlebot or other search engines you want, which would hurt your visibility.
How Long Changes Take
Google does not read your robots.txt on every visit. It keeps a copy for a while, and Google's documentation says it generally caches the file for up to 24 hours. So a change may take a day to take effect.
In urgent cases, such as removing an accidental block, the robots.txt report in Search Console lets you request a recrawl of the file.
AI Crawlers and Robots.txt
Many companies now send crawlers to collect web content for AI products. Robots.txt is one way to tell them what they may use, if they choose to respect it.
- Google-Extended is a token Google uses to let site owners control whether their content may be used to train its Gemini models and for grounding. According to Google, it does not affect whether your site is included in Google Search.
- OpenAI's GPTBot is the crawler OpenAI documents for collecting content that may be used to train its models.
- Other AI companies publish their own crawler names and rules on their websites.
Whether to allow these is a business decision. Blocking them may keep your content out of some AI training. Allowing them may help your business appear in AI answers. Be careful not to block Googlebot itself while trying to block AI crawlers, which would hide your site from Google Search.
Signs Your Robots.txt May Be the Problem
- Search results show your pages with no description, or a note that no information is available.
- The Pages report in Search Console shows a jump in pages blocked by robots.txt.
- New pages are not being crawled at all.
- Your photos never appear in Google Images.
- Traffic dropped right after a launch, migration or plugin change.
If you see any of these, open your robots.txt file first. It takes a minute and rules out one of the most common causes.
What to Do if You Blocked Your Site by Mistake
If you discover a "Disallow: /" or a similar block on your live site, act right away:
- Fix the file so it allows crawling of your public pages.
- Check any platform setting that discourages search engines, and turn it off.
- In the robots.txt report in Search Console, request a recrawl of the file.
- Use URL Inspection to request indexing for your most important pages.
- Resubmit your sitemap.
- Watch the Pages and Performance reports over the following weeks.
Recovery often starts within days once Google can crawl again, but rankings may take longer to return fully, especially if the block lasted a long time. Our guide to traffic recovery covers the steps after a serious drop.
Questions to Ask Your Developer
- Which tool or setting controls our robots.txt file?
- Can you explain every rule in it?
- Is our staging site protected by a password, not just robots.txt?
- Are any CSS, JavaScript or image folders blocked?
- What is our policy on AI crawlers, and does it accidentally affect Googlebot?
- Is robots.txt on the launch checklist for every release?
Examples From Real-World Situations
The launch-day block
Say a restaurant group in Brickell launches a new site built on a staging server. The staging robots.txt, which blocked everything, goes live with it. Two weeks later, reservations from search are down. The fix takes minutes once found: correct the file, request a recrawl and resubmit the sitemap.
The image folder
A remodeling company's robots.txt blocks its uploads folder, an old precaution from a previous developer. None of its project photos appear in Google Images. Removing the rule lets Google crawl and show the photos.
The hidden backup
A firm lists a backup folder in robots.txt, thinking it hides it. A security scan points out that the file advertises the folder to anyone. The firm moves the backups off the public server and removes the line.
How to Test Your Robots.txt
- Read it yourself. Open yoursite.com/robots.txt in a browser. Look for any "Disallow: /" line and any folders you do not recognize.
- Check the robots.txt report. In Google Search Console, it shows the robots.txt files Google found, when it last crawled them and any warnings or errors.
- Inspect important pages. Use URL Inspection on your homepage and key service pages to confirm crawling is allowed.
- Watch the Pages report. A rise in pages blocked by robots.txt is a red flag.
Google announced the robots.txt report in November 2023, replacing the older robots.txt tester. The report also lets you ask Google to recrawl the file quickly after you fix an urgent mistake.
Myths About Robots.txt
"Every site needs a long robots.txt"
Most small sites need only a few lines, or none at all. A missing file simply means no restrictions.
"Disallow keeps a page out of Google"
It keeps Google from crawling the page, not from listing its address. Use noindex for that.
"Robots.txt protects private files"
It is a public file that anyone can read. Use passwords and server settings for privacy.
"Blocking more pages helps SEO"
Only if those pages truly waste crawling. Blocking the wrong ones hides pages, images or resources Google needs.
A Robots.txt Checklist
- The file loads at yoursite.com/robots.txt without errors.
- There is no "Disallow: /" for Googlebot or all crawlers on the live site.
- CSS, JavaScript and image folders your pages need are not blocked.
- No important folder, like services or a language section, is blocked.
- No sensitive folders are listed.
- The Sitemap line points to your current sitemap.
- Every rule has a clear reason someone can explain.
- AI crawler rules, if any, reflect a deliberate decision and do not block Googlebot.
- The robots.txt report in Search Console shows no errors.
Other Search Engines Read It Too
Robots.txt is a shared standard, so other search engines, such as Bing, also read it. A rule that blocks all crawlers affects every search engine that respects the file. If you write rules for one crawler only, name it in its own user-agent group, and test carefully so you do not block the others by accident.
How We Help
Robots.txt is one of the first files we check in a technical SEO audit, along with noindex tags, sitemaps and how Google renders your pages. If your traffic dropped after a launch, our guide to traffic recovery explains how we trace the cause. For the bigger picture, see our technical SEO guide.
Robots.txt FAQ
It tells search engine crawlers which parts of your site they may crawl. Well-behaved crawlers like Googlebot read it before crawling. It controls crawling only. It does not remove pages from search results or protect private content.
No. Google says robots.txt is not a way to keep a page out of Google. If other pages link to a blocked address, Google can still list it without reading it. Use a noindex tag, password protection or delete the page instead.
Yes. A rule that disallows a single slash for all crawlers blocks everything. It is common on staging sites and causes real damage when it is copied to the live site at launch. Check your robots.txt after every launch or migration.
No. Google renders pages like a browser and needs your CSS and JavaScript files to see your layout and how the page works on phones. Blocking them can make Google misjudge your pages. Check URL Inspection's live test for blocked resources.
Open yoursite.com/robots.txt and read it, check the robots.txt report in Google Search Console for errors, and use URL Inspection on key pages to confirm crawling is allowed. The robots.txt report replaced the old tester in November 2023.
It is a token Google provides so site owners can control whether their content may be used to train Gemini models and for grounding. Google says it does not affect whether your site appears in Google Search. Blocking it is a business decision.
Google generally caches robots.txt for up to 24 hours, so changes can take about a day. For urgent fixes, such as removing an accidental block, request a recrawl of the file in the robots.txt report in Search Console.
No. If the file is missing and returns a not-found status, Google assumes there are no restrictions and crawls normally. Many small sites benefit from a short file that lists the sitemap and blocks only admin or junk areas, but it is optional.
Sources
- Google Search Central: Introduction to robots.txt
- Google Search Central: How Google interprets the robots.txt specification
- Search Console Help: robots.txt report
- Search Engine Land: Google Search Console adds robots.txt report (November 2023)
- Google Search Central: Google's common crawlers, including Google-Extended
- Google Search Central Blog: A note on unsupported rules in robots.txt (2019)
- OpenAI: Overview of OpenAI crawlers
