RankDossier
Check family

robots.txt errors: blocked sites, wrong syntax and missing files

The robots.txt file tells crawlers which paths they may fetch. Errors appear when the file is missing or returns an error, uses invalid syntax, is served with the wrong content type, grows too large, or blocks the whole site or the CSS and scripts a page needs. Return the file as plain text with a successful status, block only paths that should stay out, and add the sitemap line.

How the problem happens

A staging rule that blocks everything is copied to the live site, a plugin option hides the site from search engines, or a broad Disallow also matches the folders that hold styles and scripts.

Why a faulty robots.txt hurts rankings and AI visibility

The robots.txt file is the first thing a well-behaved crawler requests, before any page. It controls crawling, not indexing: a blocked address can still appear in results as a bare link if other sites point to it, but its content is never read. That makes one wrong line expensive. A stray Disallow: / hides the whole site, a rule on /assets/ stops Google from loading the CSS and scripts it needs to render the page, and a file that returns a server error can pause crawling of the entire host.

The file also decides which AI crawlers may read you. Training bots, search bots and user-triggered fetchers use different names, and each follows the group that matches its own name. A missing or careless file means you either admit everything by accident or shut out the assistants whose answers could cite you. Because the file is public, it is also a map: listing private paths in it advertises them instead of protecting them.

How to check robots.txt by hand

Request https://example.com/robots.txt directly with curl -i. Look at three things: the status line (200 is what you want; a 4xx is read as “no rules”, a 5xx can stop crawling), the Content-Type header (text/plain), and the size. Then read the file as a crawler does. Every line is a directive or a comment, rules sit inside a group that starts with User-agent, and a crawler obeys only the single most specific group that matches its name, so a bot-specific group replaces the * group instead of adding to it.

Look for typical mistakes: a directive written before any User-agent line, a path that does not begin with / or *, a misspelled word such as Dissalow, a relative Sitemap line, and a rule broader than intended, for example Disallow: /p blocking /products/ too. Google Search Console shows the robots.txt version Google last fetched, and the URL inspection tool tells you whether a given address is blocked and by which rule.

Also test the other direction: open a few important pages and their CSS and script files and confirm none of them is disallowed. Google generally caches the file for up to a day, so a change can take that long to be picked up.

How to fix robots.txt in code, server and CMS

Serve the file at the root of every host, as plain text in UTF-8, with status 200. Keep it short and deliberate: block only paths that waste crawl time and hold no value in search, such as internal search results, cart and checkout steps, and endless filter combinations. Never block the CSS, scripts and images a page needs, and never use robots.txt to hide pages you want kept out of results; use a noindex directive for that, on a page the crawler is allowed to fetch.

Add one Sitemap line with the full address, and give each AI crawler you want to treat differently its own group. Decide the policy deliberately: allowing search bots while disallowing training bots is possible with separate groups. Keep staging and production files separate, and check the production file after every deployment, since a staging Disallow: / copied to the live host can make a whole site drop out of search.

In WordPress the reading setting that discourages search engines adds a site-wide block, so turn it off on the live site. In a framework generate the file from code so it is versioned, and avoid redirecting /robots.txt, which some crawlers do not follow.

# https://example.com/robots.txt  (200, text/plain; charset=utf-8)
User-agent: *
Disallow: /cart/
Disallow: /search?
Allow: /assets/

User-agent: GPTBot
Disallow: /private/

Sitemap: https://example.com/sitemap.xml

How RankDossier detects robots.txt problems

RankDossier requests /robots.txt before it crawls anything. The checks in this family cover a file that is missing, one that returns a server error, syntax that crawlers would ignore, a file larger than Google reads, a content type other than plain text, a rule that blocks the whole site for Google, and rules that block CSS or JavaScript. They also report when the file disallows the audit bot itself: RankDossier respects robots.txt, so pages disallowed for it are not audited and the report says so rather than guessing.

Every finding points to the line or the response that caused it. Test a file before deploying it with the robots.txt tester and review which AI crawlers you admit with the AI bots in robots.txt. The guide to controlling crawlers explains how to choose between blocking and noindex, the pages not indexed guide helps when a blocked address still appears, and the llms.txt guide covers the companion file for AI systems.

Wrong and right

Wrong

User-agent: *
Disallow: /
User-agent: *
Disallow: /admin/

Sitemap: https://example.com/sitemap.xml

How to fix it

WordPress

In Settings, Reading, clear the option that discourages search engines, then review the robots.txt that your SEO plugin generates or the physical file in the web root.

Next.js

Create app/robots.ts that returns the rules and the sitemap address, and keep the file free of rules copied from a staging environment.

// app/robots.ts
export default function robots() {
  return {
    rules: { userAgent: '*', disallow: '/admin/' },
    sitemap: 'https://example.com/sitemap.xml',
  };
}

Nginx

Serve /robots.txt as text/plain with a successful status from the web root, and do not let a catch-all rewrite or an authentication rule cover it.

location = /robots.txt {
  default_type text/plain;
  try_files $uri =404;
}

Check codes in this family

These checks belong to this family. Each code appears in the audit report with its own explanation and fix.

  • CRAWL_ROBOTS_BLOCKS_AUDIT robots.txt disallows our bot
  • ROBOTS_MISSING robots.txt is missing
  • ROBOTS_ERROR_STATUS robots.txt returns a server error
  • ROBOTS_SYNTAX robots.txt syntax errors
  • ROBOTS_TOO_LARGE robots.txt is too large
  • ROBOTS_CONTENT_TYPE robots.txt is not text/plain
  • ROBOTS_BLOCKS_SITE robots.txt blocks the whole site for Google
  • ROBOTS_BLOCKS_RESOURCES robots.txt blocks CSS or JavaScript

Read the full guide Block AI crawlers: robots.txt rules for GPTBot and other bots for the wider picture. Test one page for free with the robots.txt tester.

Check your own site

Enter a domain – the free pre-check reads up to 10 pages and shows how many types of problems it finds. You pay only if you want the full report.

Start the free pre-check