robots.txt File Analysis
Issue No: 5
Category: Crawlability-and-indexation
Issue type: Issue
Priority: CRITICAL
Description
A robots.txt file instructs web crawlers which parts of a site may or may not be accessed; misconfigurations can inadvertently block important pages from being crawled or indexed, impacting search visibility.
How do we capture it
- Send an HTTP GET request to
https://{site_domain}/robots.txt. - Record the HTTP status code (200, 404, 500, etc.).
- Store the raw text body of the response.
- Parse all directives line-by-line:
User-agent,Disallow,Allow,Sitemap,Crawl-delay. - Record
Last-Modifiedfrom the HTTP response headers if present. - Compare against the site's known sitemap and crawl data to identify any blocked but important URLs.
- For each crawled HTML page, extract
<link rel="canonical" href="...">and evaluate whether that canonical URL's path is matched by any activeDisallowrule. Flag if blocked. - For each crawled HTML page, parse
<meta name="robots" content="...">and inspect thecontentattribute for:noindex,nofollow,max-snippet,max-image-preview,max-video-preview. Record all values. - For each HTTP response (HTML and non-HTML), record the
X-Robots-Tagresponse header value if present. For non-HTML resources (.pdf,.docx,.jpg,.png,.webp, etc.), perform an HTTP HEAD request and inspect the header. - Combine per-page signals into a composite indexability verdict: HTTP 200 + not blocked by robots.txt + no
noindexin meta tag + nonoindexinX-Robots-Tag= indexable.
What to store
| Field | Type | Comment |
|---|---|---|
content | text | Raw unparsed robots.txt body as fetched |
version | integer | Incremented each time a new fetch detects a change |
fetched_at | timestamp | When this robots.txt was last fetched |
last_modified | timestamp | Value from HTTP Last-Modified response header |
status_code | integer | HTTP status code returned (200, 404, 500, etc.) |
status | text | Human-readable status label, e.g. "OK", "NOT_FOUND" |
error | text | Error message if fetch or parse failed; null on success |
is_active | boolean | Whether this is the current active version for the site |
user_agent | text | Target crawler: "*", "Googlebot", "Bingbot", etc. |
directive | text | Rule type: "Allow", "Disallow", "Sitemap", "Crawl-delay" |
path | text | URL path or pattern this rule applies to, e.g. /admin/ |
rule_order | integer | Parse sequence order; used to resolve conflicting rules |
http_status | integer | Final HTTP status code after following redirects |
is_blocked_by_robots | boolean | True if a matching Disallow rule exists for this page's path |
canonical_url | text | Value of <link rel="canonical" href="...">, null if absent |
canonical_is_blocked | boolean | True if the canonical target path is itself blocked by robots.txt |
meta_robots_raw | text | Full raw content attribute of <meta name="robots">, null if absent |
has_meta_noindex | boolean | True if noindex found in meta robots content |
max_snippet | text | Extracted value, e.g. "-1", "150", null if absent |
max_image_preview | text | Extracted value: "none", "standard", "large", null if absent |
max_video_preview | text | Extracted value, e.g. "-1", "0", null if absent |
x_robots_tag_value | text | Raw X-Robots-Tag response header value, null if absent |
has_header_noindex | boolean | True if noindex found in X-Robots-Tag header |
is_indexable | boolean | Composite: true only when all blocking signals are absent |
checked_at | timestamp | When the audit was performed |
resource_url | text | Full URL of the non-HTML resource |
content_type | text | MIME type from Content-Type header |
is_in_sitemap | boolean | Whether this resource URL appears in the XML sitemap |
Condition for trigger
These rules define when specific issues should be flagged during crawling.
- Trigger Rule 1: Robots file missing
- Target Field:
status_code - Evaluation Logic:
= 404 - Severity: WARNING
- Diagnostic Message: "robots.txt does not exist; crawlers will crawl everything by default — may expose unintended paths"
- Target Field:
- Trigger Rule 2: Server error reading robots
- Target Field:
status_code - Evaluation Logic:
>= 500 - Severity: CRITICAL
- Diagnostic Message: "Server error when fetching robots.txt; crawlers may pause crawling the entire site"
- Target Field:
- Trigger Rule 3: Global disallow all
- Target Field:
directive - Evaluation Logic:
directive = 'Disallow' AND path = '/' AND user_agent = '*' - Severity: CRITICAL
- Diagnostic Message: "Entire site is blocked from all crawlers — nothing will be indexed"
- Target Field:
- Trigger Rule 4: Global Googlebot Block
- Target Field:
directive - Evaluation Logic:
directive = 'Disallow' AND path = '/' AND user_agent = 'Googlebot' - Severity: CRITICAL
- Diagnostic Message: "Entire site blocked specifically from Google"
- Target Field:
- Trigger Rule 5: Sitemap conflict
- Target Field:
directive - Evaluation Logic:
directive = 'Disallow' AND path = sitemap_url - Severity: IMPORTANT
- Diagnostic Message: "A URL in the XML sitemap is also Disallowed — a direct conflict"
- Target Field:
- Trigger Rule 6: Resource block conflict
- Target Field:
directive - Evaluation Logic:
directive = 'Disallow' AND path matches CSS/JS - Severity: IMPORTANT
- Diagnostic Message: "Render-blocking resources are disallowed; Google cannot render the page properly"
- Target Field:
- Trigger Rule 7: Sitemap missing
- Target Field:
content - Evaluation Logic:
Sitemap string is missing - Severity: SUGGESTION
- Diagnostic Message: "Sitemap not declared in robots.txt; crawlers must discover it independently"
- Target Field:
- Trigger Rule 8: Sensitive paths exposed in robots
- Target Field:
content - Evaluation Logic:
Disallow string contains /admin, /private, or /backup - Severity: WARNING
- Diagnostic Message: "Sensitive directory names are exposed in robots.txt, which is publicly visible"
- Target Field:
- Trigger Rule 9: Outdated robots file
- Target Field:
last_modified - Evaluation Logic:
> 365 days - Severity: SUGGESTION
- Diagnostic Message: "robots.txt has not been reviewed/updated in over a year"
- Target Field:
- Trigger Rule 10: New blocking rules discovered
- Target Field:
version - Evaluation Logic:
version > 1 AND new disallows present - Severity: WARNING
- Diagnostic Message: "New blocking rules detected compared to previously stored version — change alert"
- Target Field:
- Trigger Rule 11: Canonical is blocked
- Target Field:
canonical_is_blocked - Evaluation Logic:
= true - Severity: CRITICAL
- Diagnostic Message: "Canonical target is disallowed — Google cannot verify the canonical signal and may ignore it"
- Target Field:
- Trigger Rule 12: Broken critical page
- Target Field:
http_status - Evaluation Logic:
!= 200 - Severity: CRITICAL
- Diagnostic Message: "Page is unreachable or redirected; not indexable"
- Target Field:
- Trigger Rule 13: Meta noindex found
- Target Field:
has_meta_noindex - Evaluation Logic:
= true on critical page - Severity: CRITICAL
- Diagnostic Message: "meta robots noindex found on critical page — page excluded from index"
- Target Field:
- Trigger Rule 14: Header noindex found
- Target Field:
has_header_noindex - Evaluation Logic:
= true - Severity: CRITICAL
- Diagnostic Message: "X-Robots-Tag: noindex in HTTP response — overrides any on-page tag"
- Target Field:
- Trigger Rule 15: Warning on secondary noindex
- Target Field:
has_meta_noindex - Evaluation Logic:
= true on non-critical page - Severity: IMPORTANT
- Diagnostic Message: "Unintentional noindex on secondary content (blog, about, etc.)"
- Target Field:
- Trigger Rule 16: Missing X-Robots-Tag on private file
- Target Field:
x_robots_tag_value - Evaluation Logic:
IS NULL AND content_type is pdf/image - Severity: WARNING
- Diagnostic Message: "Private document or image may be indexed unintentionally"
- Target Field:
- Trigger Rule 17: Header noindex on sitemap resource
- Target Field:
is_in_sitemap - Evaluation Logic:
= true AND has_header_noindex = true - Severity: WARNING
- Diagnostic Message: "Sitemap declares the resource; header blocks it — contradictory signal"
- Target Field:
- Trigger Rule 18: Missing max-snippet
- Target Field:
max_snippet - Evaluation Logic:
IS NULL - Severity: SUGGESTION
- Diagnostic Message: "Google uses conservative default snippet length"
- Target Field:
- Trigger Rule 19: Missing large image preview
- Target Field:
max_image_preview - Evaluation Logic:
!= 'large' - Severity: SUGGESTION
- Diagnostic Message: "Large image previews not enabled; affects Google Images and Discover eligibility"
- Target Field:
- Trigger Rule 20: Missing video preview
- Target Field:
max_video_preview - Evaluation Logic:
IS NULL - Severity: SUGGESTION
- Diagnostic Message: "Extended video preview clips not enabled"
- Target Field:
Sources
- Google Search Central — robots.txt Introduction: https://developers.google.com/search/docs/crawling-indexing/robots/intro
- Google Search Central — robots.txt Specifications: https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt
- RFC 9309 — Robots Exclusion Protocol (IETF): https://www.rfc-editor.org/rfc/rfc9309
- robotstxt.org: https://www.robotstxt.org/
- Bing Webmaster — robots.txt: https://www.bing.com/webmasters/help/robots-txt-file-51a73f81
- Moz — robots.txt Guide: https://moz.com/learn/seo/robotstxt
- Ahrefs — robots.txt Guide: https://ahrefs.com/blog/robots-txt/
- Yoast — robots.txt Explained: https://yoast.com/robots-txt-file/
- Google — Consolidate duplicate URLs: https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
- Google — Block indexing with noindex: https://developers.google.com/search/docs/crawling-indexing/block-indexing
- Google — Robots meta tag, X-Robots-Tag: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag
- Google — X-Robots-Tag HTTP header: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#xrobotstag
- Google — Snippet controls: https://developers.google.com/search/docs/appearance/snippet
- Google — Index images on your site: https://developers.google.com/search/docs/appearance/google-images
Long description
A robots.txt file is a plain-text file placed at the root directory of a website (e.g., https://example.com/robots.txt) that follows the Robots Exclusion Protocol. It tells web crawlers — such as Googlebot, Bingbot, or any other automated bot — which URLs or sections of the site they are permitted to access and crawl.
The file is fetched by crawlers before they begin crawling a site. It is one of the first things any compliant web crawler checks. A robots.txt file consists of one or more "groups" of rules. Each group begins with one or more User-agent lines (identifying which crawlers the rules apply to), followed by Disallow and/or Allow directives.
Supported directives:
User-agent— Specifies the bot the following rules apply to.*means all crawlers.Disallow— Instructs the crawler not to access the specified path. An empty value means "allow all."Allow— Explicitly permits access to a path (overrides a broader Disallow).Sitemap— Points crawlers to the XML sitemap location.Crawl-delay— Asks crawlers to wait a specified number of seconds between requests (not supported by Google).
When both Allow and Disallow rules match a URL, the most specific rule wins. If two rules have equal specificity, Allow takes precedence over Disallow (per Google's implementation).
What robots.txt Does NOT Do:
- It is not a security tool. Any human or non-compliant bot can access blocked URLs directly. The file is publicly visible, and listing sensitive paths in it can actually expose those paths to bad actors.
- Blocked URLs can still appear in search results. If other pages link to a disallowed URL, Google can discover and index the URL (without a snippet) even if it cannot crawl it. To prevent a page from appearing in search results, use
noindexmeta tags or HTTP response headers instead. - It does not prevent caching. CDNs or third-party caches may still serve blocked content.
A page being indexable requires all four of the following to be true simultaneously. Each layer is independently capable of blocking indexation:
- HTTP 200 — The page must be reachable. A 301/302 redirect chain must ultimately resolve to a 200.
- Not blocked by robots.txt — The page's path must not match any active
Disallowrule forUser-agent: *orUser-agent: Googlebot. - No
<meta name="robots" content="noindex">— An on-page noindex tag tells the indexer to skip the page after crawling it. - No
X-Robots-Tag: noindexin the HTTP response header — takes precedence over the on-page tag if both are present.
How to Fix
- Do not block the entire site: Remove any
Disallow: /rule underUser-agent: *on production sites. If the site is in development, restrict access at the server/firewall level instead. - Do not use robots.txt to hide sensitive content: Remove sensitive directory paths from robots.txt and protect them using proper authentication.
- Allow CSS, JS, and render-critical resources: Ensure all resources needed for page rendering are accessible to search engine bots.
- Resolve sitemap conflicts: Audit the XML sitemap against robots.txt rules. Any URL present in the sitemap should not be disallowed in robots.txt.
- Declare your sitemap: Add a
Sitemap:directive pointing to your XML sitemap inside robots.txt. - Use noindex instead of Disallow to remove pages from search results: Use a meta robots tag on the page itself or return an
X-Robots-Tag: noindexHTTP response header. Do not rely onDisallowfor this purpose. - Keep robots.txt updated: Review robots.txt whenever the site's URL structure changes significantly.
- Ensure canonical targets are not blocked by robots.txt: Any canonical target that matches a
Disallowrule must be unblocked. - Audit all critical pages for composite indexability: Run a full indexability check on all URLs listed in the XML sitemap checking for conflicting
noindexdirectives or status codes. - Set X-Robots-Tag on non-HTML resources: At the server level, apply
X-Robots-Tag: noindex, nofollowto private/sensitive generic files such as PDFs andmax-image-preview:largeto large, discoverable images. - Add snippet and preview directives: Add max-snippet, max-image-preview, and max-video-preview instructions to page headers globally to maximize rich results CTR.