How to Use the Robots.txt Tester
Free tool that checks whether robots.txt is blocking Googlebot (or any user-agent) from a specific URL.
Free tool that checks whether robots.txt is blocking Googlebot (or any user-agent) from a specific URL.
What robots.txt does
The robots.txt file is a plain text file hosted at the root of a website (for example, https://www.example.com/robots.txt). It provides instructions to web crawlers, such as Googlebot, about which parts of a site they are permitted or not permitted to access. This file is part of the Robots Exclusion Protocol (REP).
The primary function of robots.txt is to manage crawler access, not to control indexing. If a page is disallowed in robots.txt, search engines generally will not crawl it. However, if other pages link to the disallowed page, or if the page is listed in a sitemap, search engines might still discover and index its URL, even if they cannot access its content. To prevent indexing, use noindex meta tags or HTTP headers.
Common uses for robots.txt include:
- Preventing the crawling of duplicate content.
- Keeping sections of a website (e.g., staging environments, admin pages) private from search engines.
- Managing crawl budget by preventing crawlers from accessing unimportant pages.
How the tester works
The LemRank robots.txt tester helps determine whether a specific URL on your website is blocked by your robots.txt file for a given user-agent.
To use the tester:
- Enter the full URL you want to test in the "URL" field. For example,
https://www.example.com/category/product-page.html. - Select the user-agent you want to simulate in the "User-agent" dropdown. Options include common crawlers like
Googlebot,Bingbot, andAdsBot, as well as a generic*which represents all crawlers not specifically named. - Click "Test URL".
LemRank fetches the robots.txt file from the root domain of the URL you provided. For example, if you input https://www.example.com/blog/article-1, the tester will look for the robots.txt file at https://www.example.com/robots.txt. The tool then parses this file using the same precedence rules documented by Google for its crawlers.
The robots.txt tester does not crawl the URL or check its live status. It only evaluates the instructions within your robots.txt file against the provided URL and user-agent.
Interpreting "allowed" vs "blocked" results
After you run a test, the tool will display one of two primary results:
- Allowed: This indicates that, according to your
robots.txtfile and the specified user-agent, the URL is permitted to be crawled. This does not guarantee that the page will be crawled or indexed, only thatrobots.txtis not preventing it. - Blocked: This indicates that, according to your
robots.txtfile and the specified user-agent, the URL is not permitted to be crawled. Search engines that respectrobots.txtwill generally refrain from accessing this URL's content.
Alongside the result, the tester will highlight the specific Disallow or Allow directive within your robots.txt file that caused the result, providing context for the decision.
For example, if your robots.txt contains:
User-agent: Googlebot
Disallow: /private/
And you test https://www.example.com/private/document.html with Googlebot, the result will be "Blocked" and the line Disallow: /private/ will be highlighted.
If you test https://www.example.com/public/page.html with Googlebot, the result will be "Allowed" because no rule explicitly blocks it.
Common robots.txt mistakes that block Google
Misconfigurations in robots.txt can inadvertently prevent search engines from accessing important parts of your website. Here are some common mistakes:
- Accidental blanket disallow: One of the most frequent errors is an overly broad
Disallowdirective. For example,Disallow: /effectively blocks all user-agents from crawling the entire website. This often happens temporarily during development or staging and is forgotten when the site goes live. - Blocking CSS/JS files: While it might seem intuitive to block directories containing stylesheets (
.css) or JavaScript (.js) files to optimize crawl budget, doing so can prevent search engines from rendering your pages correctly. This can lead to indexing issues because Googlebot needs to understand the page's layout and interactivity to properly evaluate its content and user experience. - Syntax errors: Minor typos or incorrect formatting can render
robots.txtdirectives ineffective or cause unintended blocks. For example, a missing colon or an incorrect directive name can be problematic. - Blocking sitemaps: If your
robots.txtfile accidentally blocks the path to your sitemap (e.g.,Disallow: /sitemap.xml), search engines may have difficulty discovering all the URLs on your site. The sitemap path should generally be explicitly allowed or at least not disallowed. - Conflicting directives: When multiple directives apply to a URL, understanding precedence is crucial. Sometimes, a more specific
Disallowcan override a generalAllow, or vice-versa, leading to unexpected blocks.
Regularly testing important URLs with the robots.txt tester can help identify and rectify these issues before they negatively impact your search visibility.
Wildcards and precedence rules
The robots.txt file supports wildcards to make directives more flexible.
- The asterisk
*matches any sequence of characters. - The dollar sign
$designates the end of a URL.
Examples:
Disallow: /*/private/blocks any URL with/private/in its path, such as/folder/private/page.htmlor/another/private/section/.Disallow: /images/*.jpg$blocks all.jpgfiles within the/images/directory.
When multiple rules apply to a URL, specific precedence rules determine the outcome:
- Longest match wins: Between conflicting
AllowandDisallowrules for the same user-agent, the directive with the most characters in its path normally takes precedence. For example, if arobots.txtcontainsDisallow: /aandAllow: /a/b, thenAllow: /a/bapplies to/a/b/c. - Order of
Disallowvs.Allow: If rules are identical in length,Disallowgenerally takes precedence overAllowfor Googlebot. For other crawlers, the outcome might depend on their specific implementation or the order of rules. However, Google's documentation states that forGooglebot, a more specificAllowrule will override a less specificDisallowrule.
Consider this example for Googlebot:
User-agent: Googlebot
Disallow: /folder/
Allow: /folder/specific-page.html
If you test /folder/another-page.html, it would be blocked by Disallow: /folder/.
If you test /folder/specific-page.html, it would be allowed by Allow: /folder/specific-page.html because the Allow rule is more specific.
The LemRank robots.txt tester evaluates these rules based on Google's documented precedence, providing an accurate assessment for Googlebot and other common crawlers.
Fixing a blocked page
If the robots.txt tester indicates that an important page on your site is blocked, here are steps to fix it:
- Identify the blocking directive: The tester will show you the specific
Disallowrule causing the block. Review this rule to understand why it was put in place. - Edit your
robots.txtfile: Access your website'srobots.txtfile via FTP, your hosting control panel, or your content management system's file manager. - Modify or remove the directive:
- Remove a blanket disallow: If your
robots.txtcontainsDisallow: /and it's blocking your entire site, remove this line or replace it with specificDisallowdirectives for sections you truly want to block. - Add an
Allowdirective: If a generalDisallowrule is blocking a specific important page, you can add a more specificAllowdirective. For example, ifDisallow: /blog/is present, but/blog/important-article.htmlneeds to be crawled, addAllow: /blog/important-article.html. - Refine pathways: Adjust the paths in your
Disallowrules to be more precise, ensuring they only block the intended sections.
- Remove a blanket disallow: If your
- Save and upload: Save the modified
robots.txtfile and upload it to the root directory of your website, replacing the old file. - Re-test with the LemRank tester: Use the
robots.txttester again with the same URL and user-agent to confirm that the changes have taken effect and the page is now "Allowed". - Request re-crawling (optional): For Google, you can use the URL Inspection tool in Google Search Console to request re-crawling of the specific URL once the
robots.txtblock is resolved. This helps expedite the discovery of your changes.
Keep in mind that changes to robots.txt can take some time for crawlers to discover and implement, depending on their crawl schedule.
Related
Frequently asked questions
Does the robots.txt tester execute JavaScript?
No — robots.txt is a plain text file at /robots.txt. The tester fetches it directly and evaluates the rules for the user-agent you select.
Which user-agent should I test?
Googlebot for search indexing. Googlebot-Image for image search. Bingbot for Bing. Use the specific bot most relevant to the traffic you're optimising for.
Why is my page blocked even though robots.txt allows it?
Check for meta robots noindex tags, X-Robots-Tag HTTP headers, and authentication walls. Robots.txt is only one of several ways a page can be blocked from indexing.
Related articles
Was this page helpful?
Try LemRank free
14-day Pro trial. No credit card required.