A robots.txt file tells compliant crawlers which URL paths they may or may not crawl.
It can be useful for controlling unnecessary crawling of internal search pages, faceted-navigation combinations, duplicate URL spaces, administrative paths, and other URLs that do not need crawler access.
However, robots.txt is not a general ranking tool, security mechanism, canonicalization directive, or reliable way to remove a URL from Google Search.
The correct strategy is to understand the difference between crawling, indexing, canonicalization, and access control, then use the smallest set of crawl rules necessary.
This guide is based on Google's current Robots Exclusion Protocol interpretation, Search Console documentation, common WordPress/CMS architecture and technical SEO implementation principles. It is a general robots.txt SEO guide, not a platform-specific Blogger configuration tutorial. Platform behavior and crawler support can change, so verify important production rules against current documentation.
Last verified: September 24, 2026. Crawler behavior, supported fields, Search Console reports and platform defaults can change, so recheck current documentation before deploying important production rules.
Do Not Block a URL Until You Know Why It Should Not Be Crawled
Every Disallow rule should solve a specific crawl problem. Blocking important pages, rendering resources, or URLs that contain indexing directives can make technical SEO harder rather than better.
1. What robots.txt Actually Does
| Task | Use robots.txt? | Better Mechanism When Needed |
|---|---|---|
| Control crawler access | Yes | robots.txt |
| Prevent indexing | Not reliably | robots meta or X-Robots-Tag |
| Select canonical URL | No | Canonical tags, redirects, internal links, sitemap signals |
| Protect private content | No | Authentication and authorization |
| Advertise sitemap | Yes | Sitemap directive |
2. Basic robots.txt Structure
A simple file might contain:
User-agent: *
Disallow: /internal-search/
Sitemap: https://www.example.com/sitemap.xml
A robots.txt file applies only to the host, protocol and port from which it is served. For example, rules at https://www.example.com/robots.txt do not automatically control http://www.example.com/ or another subdomain.
This tells compatible crawlers that:
For Google, robots rule groups use user-agent, allow and disallow. Google also recognizes the separate sitemap field for fully qualified sitemap URLs. Unsupported rule fields such as crawl-delay are ignored by Google's robots.txt parser. Rule field names are case-insensitive, while URL-path matching is case-sensitive.
- The rule group applies to all matching crawlers.
- The specified path should not be crawled.
- A sitemap is available at the supplied absolute URL.
3. The User-agent Directive
User-agent identifies the crawler group to which subsequent rules apply.
For all compatible crawlers:
User-agent: *
Crawler-specific groups can be useful where there is a genuine reason to apply different rules.
Avoid large copied lists of bot-specific directives unless you understand why each one exists.
4. The Disallow Directive
Disallow specifies a URL path that matching crawlers should not access.
Example:
User-agent: *
Disallow: /search/
Do not add paths simply because they look administrative or technical.
Each blocked path should be intentional.
5. Empty Disallow vs Sitewide Disallow
An empty rule:
User-agent: *
Disallow:
does not specify a blocked path.
By contrast:
User-agent: *
Disallow: /
requests that matching crawlers not crawl the site.
Disallow: / rules have been removed.
6. The Allow Directive
Allow can create an exception inside a broader disallowed path for crawlers that support the directive.
Example:
User-agent: *
Disallow: /private/
Allow: /private/public-guide.html
Use exceptions only when the parent block and the allowed subpath are both intentional.
7. Rule Matching: Specificity Matters
When more than one Allow or Disallow rule matches the same URL, Google uses the most specific matching path. If equally specific rules conflict, Google uses the less restrictive rule.
Example:
User-agent: *
Disallow: /
Allow: /public/
The more specific /public/ rule allows matching URLs even though the broader root rule disallows crawling elsewhere.
Google also supports limited path matching with * for zero or more characters and $ for the end of a URL. Use wildcards only after testing representative URLs because broad patterns can block more than intended.
8. The Sitemap Directive
A robots.txt file can advertise one or more sitemap locations.
Example:
Sitemap: https://www.example.com/sitemap.xml
The sitemap location should be a fully qualified URL including the protocol and hostname.
Multiple sitemap directives can be included where the site uses more than one sitemap.
9. robots.txt Controls Crawling, Not Guaranteed Indexing
This distinction is fundamental.
If you use:
User-agent: *
Disallow: /private-page.html
you are requesting that compliant crawlers not retrieve that path.
This does not mean:
“This URL can never appear in search.”
Google's documentation states that it may still index the URL of a blocked page when the URL is discovered through links or other signals, even though Google cannot crawl the page content.
10. Use noindex When the Goal Is Search-Result Exclusion
If an accessible page should not appear in Google Search, noindex is the appropriate page-level indexing control. Google must be able to crawl the page or resource to discover and process that directive.
Example:
<meta name="robots" content="noindex">
The crawler must be able to access the page to discover that directive.
11. Do Not Block a Page Before Google Can See Its noindex
A common mistake is:
- Add
noindexto a page. - Block the same page in robots.txt.
If Google cannot crawl the page, it may not be able to see the noindex directive.
When deindexing is the objective, keep the URL crawlable until the indexing directive can be processed unless a different removal mechanism is intentionally being used.
12. robots.txt Is Not a Security System
A robots.txt file is publicly accessible and only communicates crawl preferences to crawlers that honor the protocol.
Do not use it to protect:
- Passwords.
- API keys.
- Customer documents.
- Private backups.
- Administrative exports.
- Confidential URLs.
Use authentication, authorization, private networking, or other appropriate server-side access controls.
13. Avoid Blocking CSS and JavaScript Required for Rendering
Search crawlers may need CSS, JavaScript, images, and other resources to understand and render pages properly.
Before blocking an asset directory, determine whether it contains:
- Theme stylesheets.
- Navigation scripts.
- Page-builder resources.
- Images required for page understanding.
- Application scripts.
A broad asset-directory block can create rendering problems for crawlers.
14. Crawl Blocking Is Different from Render Blocking
These terms solve different problems.
robots.txt blocking controls crawler access.
Render-blocking resources are browser-loading resources that can delay visual rendering.
For frontend performance, continue with the Render-Blocking Resources Guide.
15. robots.txt Is Not a Canonicalization Mechanism
robots.txt cannot select the preferred version of duplicate or similar URLs.
Canonicalization can instead involve:
rel="canonical".- Permanent redirects.
- Consistent internal links.
- Sitemap URLs.
If Google cannot crawl a duplicate page because it is blocked, it may also be unable to process canonical information placed on that page.
For canonical selection, duplicate-URL signals and the difference between rel="canonical", redirects and noindex, use the Canonical URLs & Indexing Guide.
16. URL Parameters Need Analysis Before Blocking
Parameterized URLs can create large crawl spaces.
Examples:
/products?sort=price
/products?color=blue
/products?size=large
But not every URL containing a parameter is necessarily useless.
Before creating a broad block, determine:
- Whether the URLs are linked internally.
- Whether they provide unique search value.
- Whether Google is crawling them heavily.
- Whether canonicalization is more appropriate.
- Whether the application can stop generating unnecessary combinations.
17. Faceted Navigation Requires More Than robots.txt
Large ecommerce, directory, travel, or marketplace sites can create huge numbers of filter combinations.
A complete strategy may involve:
- Internal-link controls.
- Canonicalization.
- Indexing decisions.
- URL-generation controls.
- robots.txt where appropriate.
Do not attempt to solve faceted navigation exclusively with one wildcard crawl rule.
For the full URL-space strategy, continue with the Faceted Navigation SEO Guide.
18. WordPress robots.txt
WordPress installations can expose paths such as:
/wp-admin/- Internal search results.
- Author archives.
- Tag archives.
- Query-parameter combinations.
Do not copy a universal “perfect WordPress robots.txt” template without checking the site's real URL architecture.
19. Example WordPress Starting Point
A WordPress installation with a defined crawl-control requirement may use a configuration resembling:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://www.example.com/sitemap_index.xml
This is an example—not a universal recommendation.
Your sitemap location, plugin configuration, site architecture, and crawl-control requirements may differ.
20. Do Not Block wp-content as a Blanket Rule
Old SEO templates sometimes include:
Disallow: /wp-content/
This can prevent crawlers from accessing themes, plugin assets, images, CSS, and JavaScript required for rendering.
Avoid blanket asset blocking unless you understand the consequences.
21. Blogger Implementation Is Intentionally Kept in a Separate Guide
Blogger has platform-specific crawler settings, custom robots header tags, search/label URL patterns, feeds and generated sitemap behavior. Those implementation details are intentionally excluded from this general guide so the two pages do not compete for the same search intent.
Those settings deserve their own implementation guide rather than being mixed into this general robots.txt article.
This separation prevents the general robots.txt pillar and the Blogger implementation tutorial from competing for the same search intent.
22. Crawl Budget: Use the Term Carefully
Google's crawl-budget guidance is primarily relevant to very large or rapidly changing sites and to sites that expose very large URL inventories. Most smaller sites do not need advanced crawl-budget management.
Common problem areas include:
- Faceted-navigation combinations.
- Internal search URLs.
- Calendar archives.
- Session or tracking parameters.
- Infinite URL spaces.
For a smaller publication, the higher-priority tasks are often:
- Clean internal linking.
- Stable URLs.
- Correct canonicals.
- Valid XML sitemaps.
- Avoiding accidental crawler traps.
- Fixing indexing and server errors.
Do not sell robots.txt as a universal “crawl-budget booster.”
If you need evidence about which URLs Googlebot actually requests, use the Log File Analysis for Technical SEO Guide rather than inferring crawl waste from robots.txt alone.
23. robots.txt Does Not Automatically Improve Rankings
A cleaner crawl architecture can reduce unnecessary crawler activity, but a robots.txt rule does not automatically transfer ranking value to other pages.
For example:
Disallow: /search/
does not create a guaranteed ranking improvement for normal content pages.
24. Keep Sitemaps and Crawl Rules Consistent
A sitemap should primarily list canonical URLs you want search engines to discover and consider for indexing.
Avoid deliberately including:
- 404 pages.
- Redirecting URLs.
- Temporary staging pages.
- Noncanonical duplicates without a specific reason.
A URL that is important enough to submit in a sitemap normally should not also be blocked from crawling unless the architecture has a deliberate reason.
25. Sitemap Submission Does Not Override robots.txt
Submitting a URL through an XML sitemap does not override a matching Disallow rule.
Crawl-control and sitemap signals should therefore be reviewed together.
26. Check Unsupported robots.txt Directives
Do not assume every directive mentioned in old SEO tutorials is supported by Google.
Google's robots.txt documentation states that fields not listed in its supported robots.txt documentation are not supported.
For example, do not rely on unofficial robots.txt directives as substitutes for:
- Canonical tags.
- robots meta directives.
- HTTP headers.
- Server-side access controls.
27. Common robots.txt Mistakes
- Accidentally blocking the whole site:
Disallow: /. - Using robots.txt for confidential information: it is publicly readable.
- Blocking a URL whose noindex directive needs to be crawled.
- Blocking CSS and JavaScript without checking rendering impact.
- Blocking all URL parameters without classification.
- Using robots.txt as canonicalization.
- Assuming Disallow guarantees deindexing.
- Copying another site's robots.txt verbatim.
- Overengineering crawl rules on a small site with no crawl problem.
- Relying on unsupported directives from outdated tutorials.
28. Test Rules Before and After Deployment
Before changing robots.txt:
- Identify the exact URL patterns you intend to block.
- Document why those URLs should not be crawled.
- List important URLs and resources that must remain accessible.
- Review CSS, JavaScript, images, and API endpoints.
- Verify sitemap locations.
- Deploy the smallest necessary rule set.
- Inspect representative URLs afterward.
Smaller, intentional robots files are generally easier to audit than large copied templates.
29. Check and Test the Live robots.txt File
A site's robots file normally exists at the host root:
https://www.example.com/robots.txt
Check the live response after CMS, CDN, migration, domain or server changes rather than assuming the administrative interface reflects what crawlers actually receive.
For Google-specific validation, Search Console's robots.txt report can help identify parsing or availability problems for robots.txt files that Google can access.
For a specific page, URL Inspection can also show whether Google reports the URL as blocked by robots.txt. Test both the rule itself and representative affected URLs after a deployment.
If Search Console is not configured yet, use the Google Search Console Setup Guide.
30. robots.txt Availability Matters
Crawlers need to retrieve robots.txt reliably.
Google documents different behavior depending on the HTTP status returned by robots.txt. Successful 2xx responses are processed normally. Most 4xx responses, including 403, 404 and 410, are treated as though no robots.txt file exists; 429 is the important exception. 429, 5xx, DNS failures and other network-level fetch failures are treated as availability problems.
When robots.txt becomes unavailable, Google can temporarily stop or reduce crawling while it retries and may reuse the last successfully fetched rules for a period. Server errors, DNS failures, timeouts or networking problems can therefore affect crawling beyond the robots.txt URL itself.
Include robots.txt availability in:
- Hosting migrations.
- CDN changes.
- Domain migrations.
- Reverse-proxy changes.
- Major firewall changes.
31. Do Not Edit robots.txt Just Because a Page Is Not Indexed
If an important URL is missing from Google, investigate the full indexing path.
Check:
- Whether Google can crawl the URL.
- Robots meta directives.
- Canonical signals.
- HTTP status.
- Internal links.
- XML sitemap inclusion.
- Search Console URL Inspection.
A page can fail to index for reasons unrelated to robots.txt.
32. robots.txt Cannot Fix Thin or Duplicate Content
Crawl blocking does not improve the underlying quality of weak or overlapping articles.
If several pages target substantially the same intent, use:
- Content consolidation.
- Permanent redirects.
- Distinct search intent.
- Canonicalization where appropriate.
- Better internal linking.
Do not hide editorial duplication behind broad robots.txt rules.
33. robots.txt Within a Technical SEO Workflow
robots.txt is one component of a larger system:
Technical SEO Audit
↓
Crawlability
↓
Indexing Directives
↓
Canonicalization
↓
Internal Linking
↓
XML Sitemaps
↓
Monitoring
Each layer addresses a different technical SEO problem.
34. Robots.txt vs noindex vs Canonical: Final Ownership Rule
| Goal | Primary Mechanism |
|---|---|
| Reduce crawler access to a URL space | robots.txt |
| Keep an accessible page out of Google Search | noindex |
| Consolidate duplicate URL signals | rel=canonical / redirects / consistent signals |
| Protect confidential content | Authentication / authorization |
Do not substitute one mechanism for another merely because they all affect search visibility in some way.
35. Related Digital Bhatti Guides
Use this article for general robots.txt semantics. If the site runs on Blogger and the task involves Blogger settings, custom robots header tags, search/label URLs, generated sitemaps or ?m=1 behavior, move to the Blogger-specific guide instead.
- Technical audit: Technical SEO Audit Workflow.
- Blogger implementation: Blogger robots.txt & Custom Robots Header Tags Guide.
- Faceted URL spaces: Faceted Navigation SEO Guide.
- Crawler evidence: Log File Analysis for Technical SEO.
- Canonical/indexing: Canonical URLs & Indexing Guide.
- Structured data: Blogger JSON-LD Structured Data Guide.
- Rendering: Render-Blocking Resources Guide.
- Performance: Core Web Vitals Guide.
robots.txt SEO Checklist
- Use robots.txt to manage crawling, not ranking manipulation.
- Understand the difference between crawling and indexing.
- Use
User-agentto define crawler groups. - Use
Disallowonly for intentional paths. - Use
Allowonly where an exception is required. - Use fully qualified sitemap URLs.
- Do not use robots.txt as a security mechanism.
- Do not assume Disallow guarantees removal from search.
- Do not block URLs that crawlers need to access to see
noindex. - Avoid blocking CSS, JavaScript, and images blindly.
- Do not use robots.txt as a canonicalization mechanism.
- Classify URL parameters before blocking them.
- Treat faceted navigation as a broader technical SEO problem.
- Do not overstate crawl-budget issues on smaller sites.
- Do not rely on unsupported robots.txt directives.
- Keep robots.txt, canonicalization, internal links, and XML sitemaps coherent.
- Test representative URLs after every major change.
Audit Crawlability, Indexing and Canonicals Together
Once robots.txt is correct, continue through status codes, indexing directives, canonical URLs, XML sitemaps, internal linking, duplicate URLs, and other technical signals.
Open Technical SEO Audit Workflow →Frequently Asked Questions
What does robots.txt do?
robots.txt provides crawl-access rules for compliant web crawlers. It tells matching crawlers which URL paths they may or may not fetch and can also advertise sitemap locations.
Does Disallow remove a page from Google?
Not reliably. Google may still know about and index the URL of a blocked page through links or other signals even when it cannot crawl the page content.
Should I use noindex or robots.txt to remove a page from search?
If the objective is index exclusion, an appropriate robots indexing directive is usually more suitable. The page generally needs to remain crawlable so the directive can be discovered and processed.
Can robots.txt hide private files?
No. The file is publicly accessible and is not a security mechanism. Protect confidential content with authentication or other server-side access controls.
Should I block wp-content?
Not as a blanket rule. It may contain CSS, JavaScript, images, theme files, and plugin resources required for rendering and page understanding.
Does robots.txt improve crawl budget?
It can reduce crawler access to selected URL spaces, which may matter on large sites with substantial duplicate or generated URL inventories. Smaller sites generally benefit more from clean architecture and avoiding accidental crawl traps.
Should every website have a custom robots.txt?
No. A custom robots.txt file is useful when there is a defined crawl-control requirement. A simple platform-generated file may be sufficient for many websites.
Can robots.txt choose the canonical URL?
No. Canonicalization uses separate signals such as canonical tags, redirects, internal links, and sitemap URLs.
Should Blogger use the same robots.txt as WordPress?
No. Blogger has different URL patterns and platform controls. Use the dedicated Blogger robots.txt and sitemap guide for Blogger-specific configuration.
Abdul Shakoor
Founder of Digital Bhatti, an independent technical publication focused on web hosting and infrastructure, WordPress, technical SEO, web performance and automation.