What Is Robots.txt?
Robots.txt is a plain-text file that gives compliant web crawlers instructions about which URLs they may request on a website. It manages crawling rather than access for visitors. Blocking a webpage in robots.txt does not reliably remove its URL from search results or protect its content from public access.
For example, a website can use robots.txt to discourage compliant crawlers from requesting a particular URL directory.
The file tells those crawlers how to behave. It does not place a password or other access restriction on the directory.
Google’s robots.txt introduction explains its purpose and limitations.
A Simple Robots.txt Example
Consider this illustrative file:
User-agent: *
Disallow: /demo-pages/
Sitemap: https://example.com/sitemap.xml
Here:
| Line | Meaning |
|---|---|
User-agent: * | Identifies the general crawler group |
Disallow: /demo-pages/ | Disallows crawling of matching paths beginning with /demo-pages/ |
Sitemap: | Provides the location of a sitemap |
This example explains the syntax. A real file should reflect the website’s URLs and intended crawler behavior.
The sitemap declaration does not override a disallow rule or guarantee that listed URLs will be indexed.
Where Is Robots.txt Located?
The file belongs at the root of the relevant website host.
For example:
https://example.com/robots.txt
A file at this address would not serve the same role:
https://example.com/blog/robots.txt
Rules apply within the relevant protocol, host, and port. Do not assume that one file automatically governs every subdomain.
Google’s robots.txt creation guide explains the location and format requirements.
How Does Robots.txt Work?
A crawler that follows the protocol checks the file and applies the relevant rules before requesting covered URLs.
The file can contain groups for different crawlers.
Its interpretation depends on the crawler’s supported rules and matching behavior.
For a technical reference, see the Robots Exclusion Protocol standard.
For search engines, this sits within the broader process of crawling.
What Do User-Agent, Disallow, and Allow Mean?
| Directive | Purpose |
|---|---|
User-agent | Identifies the crawler or crawler group |
Disallow | Specifies paths that should not be crawled |
Allow | Specifies an allowed path, including an exception where supported |
Sitemap | Identifies a sitemap location |
For example:
User-agent: *
Disallow: /demo-pages/
Allow: /demo-pages/public-example/
For Google’s matching behavior, the more specific allowed path can permit the public-example directory while the broader restriction remains.
Do not assume that the last line automatically wins. Google documents path matching and rule selection in its robots.txt specification guidance.
Why Does Robots.txt Matter for SEO?
It Can Affect Access to Important Content
An unintended restriction can prevent a compliant search crawler from requesting a service page or an entire website section.
Review the actual rule before changing the page’s content.
It Helps Manage Unnecessary Requests
Some websites expose many URLs that do not need repeated crawling.
Rules may be useful when they address a clear technical requirement.
A small website does not need a complicated file simply because robots.txt exists.
It Can Affect Rendering
Blocking resources needed to display a page can affect how a crawler understands it.
Check scripts, styles, and other dependencies before restricting whole directories.
It Makes Crawl Decisions Explicit
A documented file helps explain which restrictions are intentional.
That is particularly useful during redesigns, migrations, and changes to the website platform.
The crawlability vs indexability guide explains why access and indexing need separate checks.
Robots.txt vs Noindex
Robots.txt controls crawling. Noindex controls inclusion in search results for supporting search engines.
| Method | Main purpose |
|---|---|
Robots.txt Disallow | Restrict compliant crawler requests |
noindex | Instruct supporting search engines not to index the resource |
| Authentication | Restrict who can access content |
Google needs to retrieve a page to see a noindex instruction supplied in its HTML or response headers.
Blocking that retrieval can prevent the instruction from being processed.
Read Google’s noindex guidance before combining these controls.
Robots.txt vs XML Sitemaps
Robots.txt provides crawl instructions.
An XML sitemap lists URLs for search engine discovery.
They serve different purposes even when the sitemap’s address appears in robots.txt.
| Robots.txt | XML sitemap |
|---|---|
| Describes crawl permissions | Lists URLs |
| Can restrict matching requests | Can support discovery |
| Does not guarantee removal from search | Does not guarantee indexing |
If an important URL is listed in the sitemap but blocked unintentionally, investigate the conflict.
How to Find and Review Robots.txt
1. Open the Root URL
Add /robots.txt to the relevant website origin.
Check the final address and response rather than assuming the displayed file applies to every host.
2. Identify the Relevant Crawler Group
Look for the user-agent rules that apply to the crawler being investigated.
Review specific groups as well as the general group.
3. Check Important URLs
Compare the rules with representative service pages, articles, categories, and required resources.
Test the paths that matter rather than reading the file only in isolation.
4. Review Search Console
Google Search Console’s robots.txt report can show fetched files, retrieval information, and parsing issues for supported properties.
See Google’s robots.txt report documentation.
5. Compare the Live File With the Intended Configuration
Your CMS, hosting platform, or deployment process may generate the file.
Confirm where the rules are maintained before editing a copy that could later be overwritten.
What Does “Blocked by Robots.txt” Mean?
It means a relevant robots.txt rule prevented the crawler from requesting the URL.
Whether that is a problem depends on the page’s purpose.
| Situation | Review |
|---|---|
| An important service page is blocked accidentally | Identify and correct the unintended restriction |
| A deliberately restricted URL is reported | Confirm that the restriction still matches the goal |
| A blocked page should disappear from search | Review indexing controls separately |
| Required page resources are blocked | Test the effect on rendering |
Do not remove every restriction simply to clear an audit report.
Common Robots.txt Mistakes
Confusing an Empty Disallow With a Slash
These are different:
Disallow:
Disallow: /
An empty value does not block paths. A slash matches the root path and can block crawling across the applicable site scope.
Always review the surrounding user-agent group.
Using It to Hide Confidential Information
Robots.txt is publicly accessible and does not enforce access authorization.
Use appropriate authentication and permissions for private material.
Copying Another Website’s File
Its paths, platform requirements, and crawler goals may differ from yours.
Every rule should have a reason.
Blocking a Page That Needs Noindex Processing
A crawler needs access to read the page-level instruction.
Plan the combination according to the desired result.
Leaving Development Restrictions in Production
Review crawl settings when a website launches or moves.
Keep a record of the intended production configuration.
How to Review Changes Before Publishing
For each proposed change, record:
- The problem being addressed.
- The crawler group affected.
- The paths that should match.
- Important paths that should remain unaffected.
- The test results.
- How to restore the previous configuration if needed.
After publication, verify the live file and the affected URLs.
Avoid changing several unrelated rules at once when a targeted correction will resolve the issue.
Related SEO Terms
Continue through the SEO glossary:
Are Crawl Rules Affecting Your Important Pages?
Start with the URLs customers need to understand your offer and contact your business.
I’m Sachin Pokharel. My technical SEO services support investigations into crawl restrictions, indexing settings, and related website issues.
Discuss your website’s robots.txt configuration.
Share your website, affected URLs, and any audit or Search Console findings so we can discuss what needs reviewing.
Frequently Asked Questions
Does Every Website Need a Robots.txt File?
No. Google’s documentation says that a missing file returning a normal not-found response does not prevent it from crawling the website. A file becomes useful when you have crawl instructions to communicate. Check platform requirements and existing behavior before creating one, rather than assuming its presence alone improves SEO.
Can Robots.txt Remove a Page From Google?
It is not a reliable removal method for webpages. Google can sometimes retain or show a known URL without crawling its content. If the goal is exclusion from search, review a supported indexing control. If the content is private, restrict access directly. Choose the method according to the outcome you need.
Is Robots.txt the Same as a Robots Meta Tag?
No. Robots.txt is a separate file containing crawler instructions. A robots meta tag appears within a webpage and can contain instructions such as noindex. Their location and function differ. When investigating an issue, inspect both the applicable crawl rules and the page’s indexing instructions instead of treating them as interchangeable.
Should I Add Noindex to Robots.txt?
Google does not support noindex as a robots.txt rule. For Google, use a supported robots meta tag or HTTP response header when exclusion is appropriate. Make sure the crawler can access the resource to read that instruction. Simply adding an unsupported line to the file does not achieve the intended result.
Will Every Bot Follow Robots.txt?
No. The protocol depends on crawler cooperation and is not an access-control system. Different services also support different directives and behaviors. Use the relevant crawler’s documentation when designing specific rules. If you need to enforce access restrictions, that requires measures beyond publishing instructions in robots.txt.
Can I Edit Robots.txt Through My CMS?
Sometimes. A CMS, plugin, or hosting service may generate the file or provide an interface for managing crawl settings. Check how your platform handles it before editing server files. Then verify the published response. The important result is the live configuration, including any rules added automatically by the platform.
How Quickly Do Robots.txt Changes Take Effect?
Do not assume every crawler processes an edit immediately. Crawlers can cache the file and refresh it according to their own behavior. Verify the live version first, then review available retrieval information. For critical Google-related corrections, the Search Console report provides options described in its documentation.
Can a Robots.txt Mistake Block My Whole Website?
Yes. A broad restriction in the applicable crawler group can prevent crawling throughout the relevant site scope. That does not necessarily remove all known URLs from search immediately, but it can interfere with processing content. Test representative URLs before publishing, particularly when changing broad paths or replacing the whole file.