Home » SEO » Robots.txt Blocking Important Pages: Check and Fix Your Crawl Rules
Robots.txt Blocking Important Pages: Check and Fix Your Crawl Rules
robots.txt is a plain text file at the root of your site that tells search engine crawlers which paths they may and may not fetch. It is simple and powerful, which is why it causes trouble: a single Disallow: / left from development quietly removes a whole site from search.
For problems with the sitemap itself, see sitemap not found. This guide covers crawl rules.
Step 1: read your current file
Open https://yourdomain.com/robots.txt in a browser. A healthy file for most small sites looks like this:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://yourdomain.com/sitemap.xml
Warning signs:
| Rule | Effect |
|---|---|
Disallow: / |
Blocks the entire site |
Disallow: /blog |
Blocks /blog, /blog/, and also /blog-news/ (it is a prefix match) |
Disallow: /*.css or /*.js |
Stops crawlers rendering pages properly |
Disallow: /wp-content/ |
Blocks images, styles and scripts in WordPress |
Sitemap: with http:// or a wrong domain |
Points crawlers at a dead sitemap |
| The file returns 5xx | Google may stop crawling the site until it recovers |
Step 2: understand how rules match
- Rules are grouped by
User-agent. A crawler follows the most specific group that names it, and ignores the*group if its own exists. - Paths are prefixes and case-sensitive.
*matches any characters;$marks the end of the URL.- When
AllowandDisallowboth match, the longer (more specific) rule wins.
Disallow: /search # blocks /search, /search?q=x, /searchable
Disallow: /search$ # blocks only /search exactly
Disallow: /*? # blocks every URL with a query string
Step 3: test important URLs
Google Search Console's URL Inspection tool shows whether a URL is "Blocked by robots.txt". Test your homepage, a post, a category page and an image. Search Console also has a robots.txt report under Settings that shows the file Google last fetched and any parse errors.
Step 4: check for noindex tags too
Many "invisible site" problems are not in robots.txt at all but in a noindex instruction:
<meta name="robots" content="noindex, nofollow">
or an X-Robots-Tag: noindex HTTP header. Check with:
curl -sI https://yourdomain.com/ | grep -i x-robots
In WordPress, the setting Settings → Reading → "Discourage search engines from indexing this site" adds a noindex to every page. It is often ticked during development and forgotten at launch.
Note: if a page is blocked in robots.txt, crawlers never see its noindex tag. To remove a page from search, allow crawling and add noindex.
Step 5: fix and confirm
- Edit
robots.txt(in the site root, or through your SEO plugin, which may generate it). - Remove
Disallowlines that block real content or assets. - Make sure the
Sitemap:line has the full HTTPS URL. - Untick "Discourage search engines" if set.
- In Search Console, inspect your key URLs and click Request indexing.
Common mistakes
- Copying a staging site's robots.txt to production.
- Using robots.txt to hide private pages. The file is public and lists exactly what you are hiding. Use authentication instead.
- Blocking pages and adding noindex at the same time, so the noindex is never seen.
- Forgetting that the rules are prefixes, and blocking more than intended.
Frequently Asked Questions
Does robots.txt remove pages from Google?
No. It stops crawling, not indexing. A blocked page can still appear in results (without a description) if other sites link to it. To keep a page out of results, allow crawling and use a noindex tag instead.
Do I need a robots.txt file at all?
Not strictly. With no file, crawlers assume everything is allowed. A short file that points to your sitemap is still useful.
Should I block CSS and JavaScript files?
No. Search engines render pages like a browser and need those files to understand the layout and content. Blocking them can hurt how pages are evaluated.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.