What is robots.txt?
robots.txt is the file of crawl rules for crawlers such as Googlebot. It always lives at the root of the domain, for example example.com/robots.txt, and applies only to the domain, protocol, and subdomain where it sits.
robots.txt is not a way to hide a page from Google. A blocked page can still appear in results without a description when other pages link to it. To keep a page out, use noindex or a password, as explained in the robots.txt introduction from Google.
What does a safe robots.txt look like?
A safe robots.txt blocks only the admin area and names your sitemap. The example below matches the WordPress default rules, plus a sitemap line.
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://example.com/sitemap_index.xml - The User-agent line with a star means the rules apply to every crawler.
- The Disallow line closes the WordPress admin folder.
- The Allow line keeps admin-ajax.php open, which many themes and plugins use.
- The Sitemap line gives the address of your XML sitemap. Replace it with your own.
Which mistakes block the whole site?
The most dangerous mistake is Disallow with a single slash, which closes the entire website. This rule often carries over from a staging site when the site moves to its real domain.
User-agent: *
Disallow: / - Blocking CSS, JavaScript, or image folders, so Google cannot see how the page really looks.
- Blocking pages that carry noindex, so Google never reads that noindex.
- Wrong letter case, because robots.txt rules treat /Products/ and /products/ as different paths.
- Placing robots.txt in a subfolder. Google reads only the file at the root of the domain.
- Writing noindex in robots.txt. Google does not support that rule.
How do you check robots.txt?
The fastest check is opening your-domain.com/robots.txt in a browser. If you see Disallow with a single slash under User-agent star, the whole site is closed to crawlers.
- In Search Console, open Settings, then the robots.txt report, to see the version Google read and any errors.
- Check important pages with URL Inspection. Blocked by robots.txt means your rules close that page.
- After a fix, request a recrawl of robots.txt from the same report.
The full rules are in the create robots.txt guide from Google.
How can Rankomodo help?
The Rankomodo audit reads robots.txt with the Googlebot rules and flags a whole site block as a P0 issue. It also flags sitemap URLs blocked by robots.txt, because a sitemap should list only pages crawlers may visit.
Common questions
Does every website need a robots.txt file?
No. Without robots.txt, crawlers may visit every page. WordPress also serves a virtual robots.txt automatically when no file exists.
Related guides
- Why is my page not showing up on Google?Common causes, how to check in Search Console, and how long indexing takes.
- XML sitemap, how to create and submit itWhat a sitemap does, how to create one in WordPress, good contents, and submitting.
- Noindex and canonical, when to use themNoindex versus canonical, when to use each, common mistakes, and how to check.