Speed & search
The Draftly Paper
14 May 2026
Robots.txt SEO Best Practices: What to Block and What to Allow
Learn the critical robots.txt SEO best practices. We cover what to block (admin pages, search results) and what to allow (CSS, JS) to optimize crawl budget and improve your rankings.
Think of your website's robots.txt file as the friendly bouncer at the front door of your digital space. It’s the first thing search engine crawlers, like Googlebot, look for when they visit. Its job is to give clear instructions on which rooms (pages) are open to the public and which are off-limits. Mastering robots.txt SEO best practices isn't just a technical formality; it's a strategic move to guide search engines, protect your crawl budget, and ensure your most important content gets the attention it deserves.
A misconfigured robots.txt file can be catastrophic, effectively making your site invisible to Google. Conversely, a well-optimised one directs crawling power exactly where it needs to go, improving indexing speed and efficiency.
The Role of Robots.txt in Modern SEO
At its core, the robots.txt file is about one thing: managing crawl budget. Every website is allocated a certain amount of resources by search engines for crawling. Google isn't going to spend all day on your site. It will crawl a certain number of pages and then move on. If it wastes 40% of that time crawling low-value pages like internal search results or filtered navigation, your critical product and service pages might not get re-crawled for weeks.
Effective crawl budget management means you're telling Google: "Hey, don't waste your time in the junk drawers. The good stuff is right here." This ensures your new blog posts, updated pages, and core content are discovered and indexed faster. It’s a foundational piece of any solid technical SEO checklist and directly impacts how efficiently search engines understand your site's structure and value.
What You Absolutely Should Block
Your goal with blocking is to prevent crawlers from wasting time on pages that offer zero value in a search result. Here are the most common and critical directories and file types to Disallow.
Admin and Login Pages
These pages are for internal use only and have no place in search results. Leaving them open to crawlers is a waste of resources.
Disallow: /admin/Disallow: /wp-admin/Disallow: /login
Internal Search Result Pages
When a user searches on your site, it often generates a unique URL (e.g., yourdomain.com/search?q=widgets). These pages are considered thin, often duplicate content by Google and can number in the thousands on large sites, creating a massive crawl budget trap.
Disallow: /search/Disallow: /*?s=Disallow: /*?q=
Shopping Cart and Checkout Funnels
Pages like /cart, /checkout, and /my-account are unique to each user's session and provide no value to someone searching on Google. Indexing them is pointless and consumes valuable crawl budget.
Disallow: /cart/Disallow: /checkout/Disallow: /orders/
Unnecessary Files and Scripts
This includes temporary files, specific scripts, or PDF documents intended for direct download only, not for discovery via search.
Disallow: /tmp/Disallow: /scripts/Disallow: /assets/pdf/
What You Must Always Allow
Blocking the wrong thing can be far more damaging than not blocking anything at all. A single incorrect line can de-index your entire website. Here’s what needs a green light.
CSS and JavaScript Files
This is the most common and damaging mistake we see. Google needs to access your CSS and JS files to render your website properly. If it can't, it sees a broken, un-styled page. This severely impacts its ability to understand your content and is a negative signal for Page Experience. Studies show that over 10% of mobile crawling issues are related to blocked resources.
Allow: /assets/css/Allow: /assets/js/Allow: /*.jsAllow: /*.css
Your XML Sitemap
While Google will likely find your sitemap eventually, explicitly stating its location in your robots.txt is a best practice. It’s a direct instruction telling crawlers where to find the map of all your important URLs. Most sites built with modern platforms, including the Draftly sitemap and robots.txt feature, handle this automatically.
- Add this line anywhere in your file:
Sitemap: https://www.yourdomain.com/sitemap.xml
Core Content and Media
It might seem obvious, but you need to ensure your primary content folders are not accidentally disallowed. This includes your blog, product images, and service pages.
Robots.txt vs. Noindex: A Critical Distinction
Many people confuse Disallow in robots.txt with the noindex meta tag. They serve very different purposes.
Disallow: This tells a search engine, "Do not crawl this page." However, if the page is linked to from other places on the web, Google might still index the URL without visiting it. You might see it in search results with a title but no description.noindex: This is a meta tag you place in the<head>section of a specific page. It tells Google, "You can crawl this page, but do not show it in search results." This is the correct way to prevent a page from being indexed.
Rule of thumb: If you don't want a page crawled or indexed (like an admin page), use robots.txt. If you want to allow crawling but prevent indexing (like a thank-you page or a thin author archive), use the noindex tag.
How to Test Your Robots.txt File
Before deploying a new robots.txt file, you must test it. An accidental Disallow: / can take your entire site offline from search results within a day.
- Create the File: In a simple text editor, create a file named
robots.txt. - Add Directives: Add your
User-agent,Disallow, andAllowrules. Always start withUser-agent: *to apply rules to all bots, then add more specific rules if needed. - Use Google's Tester: The best way to check your work is with Google Search Console's robots.txt Tester. You can paste your code and test specific URLs to see if they would be blocked or allowed. If you haven't already, make sure you set up Google Search Console for your new website to access this tool.
- Upload to Root: Once tested, upload the file to the root directory of your website (e.g.,
https://www.yourdomain.com/robots.txt).
Properly managing your robots.txt is a simple yet powerful SEO lever. By telling search engines exactly where to look and what to ignore, you streamline the crawling process, speed up indexing, and ensure your best content gets the visibility it deserves.
Ready to build a website where technical SEO is handled right from the start? Draftly turns your prompt into a cinematic, fully-optimised 3D website in minutes.
Questions people ask
What is the difference between disallow in robots.txt and a noindex tag?
Disallow in robots.txt prevents search engines from crawling a page, but it might still get indexed if linked externally. A noindex meta tag allows crawling but explicitly tells search engines not to show the page in search results. Use noindex for pages you want removed from search, and disallow for pages you don't want crawled at all.
Does every website need a robots.txt file?
While not strictly mandatory, every website benefits from a robots.txt file. Without one, search engines will try to crawl every single page they can find, which can waste your crawl budget on low-value pages. A simple robots.txt file provides essential guidance for crawlers and is a fundamental SEO best practice.
What is the most common mistake in a robots.txt file?
The most catastrophic mistake is an incorrect Disallow: / directive, which blocks your entire website from search engines. Another very common error is blocking CSS and JavaScript files, which prevents Google from rendering your page correctly and can severely harm your rankings and user experience signals.




