A robots.txt file is a text file at your website's root. It tells search engine crawlers which pages or files to access or index. It's a key tool for technical SEO, controlling crawler behavior and protecting sensitive content.
A well-set up robots.txt file:
Improves crawl efficiency by blocking irrelevant or duplicate content
Prevents indexing of private files, admin pages, and dev environments
Helps preserve crawl budget for large sites
Supports SEO goals by focusing search engine bots on key pages
Enhances website security by disallowing access to sensitive folders
Directive | Purpose | Example |
---|---|---|
User-agent | Specifies the bot the rule applies to | User-agent: * |
Disallow | Blocks access to a specific file or folder | Disallow: /admin/ |
Allow | Grants access to a specific file or path | Allow: /images/logo.png |
Sitemap | Provides the URL of the XML sitemap | Sitemap: https://example.com/sitemap.xml |
Crawl-delay | Limits how fast a bot can crawl | Crawl-delay: 10 (not supported by Google) |
Enter Your Site Details
Input your domain (e.g., https://example.com) and select the user-agents (bots) you want to control.
Select Pages or Folders to Block
Choose common directories like /admin/, /cgi-bin/, or custom folders to disallow.
Add Sitemap URL
Improve crawling by including the direct URL of your sitemap.
Generate and Download the File
Copy or download the robots.txt code generated.
Upload to Your Website’s Root Directory
Place it in your root folder (https://example.com/robots.txt).
Test Your File with Google
Use the robots.txt Tester in Google Search Console to check for issues.
mermaid
Copy
Edit
flowchart TD A[Search Engine Bot Requests Page] --> B[robots.txt Accessed] B --> C{Does Rule Exist for Bot?} C -- Yes --> D{Is Page Disallowed?} D -- Yes --> E[Page Not Crawled] D -- No --> F[Page Crawled and Indexed] C -- No --> F
txt
Copy
Edit
User-agent: * Disallow:
txt
Copy
Edit
User-agent: * Disallow: /admin/ Disallow: /login/
txt
Copy
Edit
User-agent: * Disallow: /
txt
Copy
Edit
User-agent: Googlebot Disallow: /testing/ User-agent: Bingbot Disallow: /old-data/
txt
Copy
Edit
User-agent: * Disallow: Sitemap: https://example.com/sitemap.xml
✅ Always test your file using Google’s robots.txt tester
✅ Use lowercase paths for consistency
✅ Don’t block important content accidentally
✅ Don’t use robots.txt to hide private data (use authentication or noindex)
✅ Include your sitemap URL for better indexing
✅ Avoid using wildcards unless necessary (e.g., Disallow: /*?ref=)
❌ Don’t block JavaScript or CSS folders (Google needs them to render your site)
❌ Don’t use it to deindex pages — use noindex in meta tags instead
❌ Don’t forget to update it when launching new sections
❌ Don’t mix up Allow and Disallow — order and specificity matter
Tool | Features | Ideal For |
---|---|---|
SEOptimer Robots.txt Generator | Simple UI, pre-set directory options, free to use | Beginners & marketers |
Yoast SEO (WordPress) | Dynamic robots.txt editing within WordPress | WordPress users |
TechnicalSEO.com Generator | Wildcard & crawl-delay support, JSON preview | Technical SEOs |
Screaming Frog | Robots.txt testing and simulation | Advanced SEOs |
Google Search Console | Testing tool only | Robots behavior validation |
Block checkout and cart pages from indexing:
txt
Copy
Edit
User-agent: * Disallow: /cart/ Disallow: /checkout/
Prevent duplicate tag archive pages:
txt
Copy
Edit
User-agent: * Disallow: /tag/ Disallow: /category/
Block entire staging site from being crawled:
txt
Copy
Edit
User-agent: * Disallow: /
A: In the root directory of your site: https://yourdomain.com/robots.txt
A: No. Use noindex meta tags to ensure deindexing. Robots.txt only blocks crawling.
A: Yes. Use:
txt
Copy
Edit
Disallow: /*.pdf$ Disallow: /images/
A:
txt
Copy
Edit
Disallow: /private/ Allow: /private/allowed-file.html
A well-crafted robots.txt file is key for SEO. It guides search engine crawlers and helps manage crawl budgets. It also stops indexing of content you don't want seen. With a free robots.txt generator, you can make your file in seconds and upload it to protect and enhance your website’s visibility.
Copyright © 2025 Seotoolsn.com . All rights reserved.