π
FREE
+30 XP
The robots.txt File
π
Alex, Trainee Β· Wednesday, 09:15
I open Google Search Console. Traffic: 0. Pages indexed: 0 of 847. This can't be right...
π€
CEO Β· 09:18
"ALEX. ALL TRAFFIC IS GONE. WHY ARE ZERO PAGES OUT OF 847 INDEXED?! THIS IS A CATASTROPHE!"
π€¦
Alex Β· 09:21
I open robots.txt. Everything is clear now.
User-agent: *
Disallow: /
# Bye bye π
# β Peterson
Disallow: /
# Bye bye π
# β Peterson
What is robots.txt?
It's an instruction file for search engine bots. It lives at the root of your site: yourdomain.com/robots.txt
Think of it as a security guard at the building entrance β it tells bots: "you can go here, but not there".
Allow: /
Public pages are open. Bots can crawl and index them.
Public pages are open. Bots can crawl and index them.
Disallow: /admin/
Private sections are blocked. Bots should not enter.
Private sections are blocked. Bots should not enter.
User-agent: *
Disallow: /admin/
Disallow: /private/
Allow: /
What this means:
User-agent: *β rules for all botsDisallow: /admin/β do not crawl the /admin/ folderAllow: /β everything else is accessible
The biggest misconception about robots.txt
π« robots.txt does NOT prevent indexing!
If a bot doesn't crawl a page β that doesn't mean Google won't index it. Google can learn about it through links and add it to the index without ever visiting.
To actually block a page from indexing β use:
If a bot doesn't crawl a page β that doesn't mean Google won't index it. Google can learn about it through links and add it to the index without ever visiting.
To actually block a page from indexing β use:
<meta name="robots" content="noindex">Sitemap link
Best practice: add a link to sitemap.xml in robots.txt β this helps Google discover all your pages faster:
User-agent: *
Disallow: /admin/
Sitemap: https://example.com/sitemap.xml
π‘ Pro tip: Check robots.txt via Google Search Console β "robots.txt Tester". The most common mistake is accidentally writing
Disallow: / and blocking the entire site. Like Peterson did ππ
Alex Β· 09:45
Removed Disallow: /. Updated robots.txt. Now waiting for Google to recrawl. First crisis: handled.
Ready? Type your answer in the task! π
Lesson Task
Test your knowledge and earn +20 XP