🤖 Robots.txt Guide

Control How Search Engines Crawl Your Site

📄 What is Robots.txt?

📄

Text File

A plain text file at your domain root

🤖

Bot Instructions

Tells crawlers what to access or avoid

📍

Location

yourdomain.com/robots.txt

⚠️

Advisory

Suggestions, not enforced rules

📝 Robots.txt Syntax

# This is a comment

User-agent: *
Disallow: /admin/
Disallow: /private/
Allow: /public/

User-agent: Googlebot
Disallow: /no-google/

Sitemap: https://example.com/sitemap.xml
User-agent:

Specifies which bot the rules apply to

Disallow:

Blocks access to specified paths

Allow:

Permits access to paths within disallowed directories

Sitemap:

Points to your XML sitemap location

💡 Common Examples

Allow All Bots Open

Allow all crawlers to access everything.

User-agent: *
Disallow:

Block All Bots Blocked

Block all crawlers from entire site.

User-agent: *
Disallow: /

Block Specific Directory Partial

Block crawlers from admin area.

User-agent: *
Disallow: /admin/
Disallow: /login/

Block Specific Bot Targeted

Block only a specific crawler.

User-agent: BadBot
Disallow: /

User-agent: *
Disallow:

⚠️ Common Mistakes

Blocking CSS/JS

Blocking CSS and JavaScript files prevents Google from rendering your page properly.

✓ Allow access to CSS and JS files

Blocking Entire Site

Using Disallow: / blocks your entire site from indexing.

✓ Only block specific private sections

Wrong File Location

Robots.txt must be at the root domain, not in subdirectories.

✓ Place at yourdomain.com/robots.txt

Using for Security

Robots.txt is not for hiding sensitive content - it's publicly visible.

✓ Use authentication for truly private content

🤖 Common User Agents

🔵

Google

Googlebot
🔷

Bing

Bingbot
🟣

Yahoo

Slurp
🟢

DuckDuckGo

DuckDuckBot
🖼️

Google Images

Googlebot-Image
🎥

Google Video

Googlebot-Video
📰

Google News

Googlebot-News

All Bots

*

🧪 How to Test Your Robots.txt

1

Visit yourdomain.com/robots.txt to verify file exists

2

Use Google Search Console's robots.txt Tester tool

3

Check URL Inspection tool for crawl issues

4

Monitor Coverage report for blocked pages

📋 Robots.txt Checklist

Setup

Configure

Verify