How to Set Up Robots.txt

Table of Contents

TL;DR: To set up robots.txt, create a text file, upload it to your site’s root, block useless pages, allow critical ones, and add your sitemap link.

Last Updated: March 2026

Key Takeaways

  • Robots.txt guides search engine crawlers
  • Blocks unwanted pages like admin
  • Speeds up indexing of key pages
  • Must be in root domain
  • Include XML sitemap for efficiency

A properly configured robots.txt file prevents search engines from wasting time crawling unimportant pages. It directs Google’s attention to your money-making content instead.

For Kenyan businesses competing in crowded Nairobi markets, understanding what robots.txt files do means faster indexing of your key service pages and better rankings where it counts.

Imagine you run an online electronics store selling laptops and smartphones across Kenya. Without a robots.txt file, Google wastes crawl budget on your cart page, checkout process, and admin login.

These are pages customers never need to find in search. Meanwhile, your product pages for “MacBook Air Kenya” and “Samsung Galaxy price Nairobi” get indexed slowly.

A smart robots.txt file blocks the junk and speeds up indexing for pages that actually drive M-Pesa transactions.

Steps to Set Up a Robots.txt File for Your Kenyan Business

Step 1: Create a plain text file named exactly “robots.txt” (all lowercase)

Use Notepad, TextEdit, or any plain text editor. Never use Word or Google Docs.

This perfecting technical SEO fundamentals step ensures search engines can read your instructions properly.

Step 2: Upload it to your website’s root domain

Place it at yoursite.co.ke/robots.txt, not in subfolders like /admin/ or /blog/.

This location tells mastering web crawling processes where to find your crawling instructions first.

Step 3: Block administrative and duplicate content pages

Add lines like “Disallow: /admin/”, “Disallow: /cart/”, and “Disallow: /*?sort=” to keep Google away.

This protects the understanding of what technical SEO principles of efficient crawl budget management.

Step 4: Allow access to important pages explicitly

Add “Allow: /products/”, “Allow: /services/” to ensure Google can crawl your revenue pages.

Clear permissions help indexing your website pages happen faster for critical content.

Step 5: Add your XML sitemap location at the bottom

Include “Sitemap: https://yoursite.co.ke/sitemap.xml” to help Google find all your pages.

This connects your robots.txt with setting up XML sitemaps properly for maximum indexing efficiency.

Step 6: Test it using Google Search Console’s robots.txt Tester

Verify you haven’t accidentally blocked critical pages before going live.

Testing prevents the disasters that come from blocking pages that should be ranking.

Your Robots.txt Setup Checklist:

Infographic showing the six-step robots.txt setup process for Kenyan businesses. Visual flowchart displays file creation, root domain upload, blocking admin pages, allowing product pages, adding sitemap URL, and testing in Google Search Console. Each step includes icons representing technical actions, with checkmarks indicating completion. Designed for Nairobi-based business owners managing their own technical SEO, showing the logical sequence from creating the plain text file through final verification that prevents crawl budget waste on unimportant pages.
Robots.txt setup flowchart for Kenya businesses showing six implementation steps.
  • ☐ File named “robots.txt” exactly
  • ☐ Uploaded to the root domain
  • ☐ Admin pages blocked
  • ☐ Product/service pages allowed
  • ☐ XML sitemap URL added
  • ☐ Tested in Search Console
  • ☐ No critical pages blocked

Set this up this afternoon. It takes 15 minutes.

Based on AM Digital KE client data across Kenyan accounts, you’ll notice improved crawl efficiency in Search Console within 5-7 days. Your priority pages will appear in search results faster.

Small technical win, significant competitive advantage.

Need clarity on technical terms? Check out my SEO FAQs page for a complete glossary of crawling and indexing concepts.

Want to cover all technical bases? Download this complete SEO Checklist to ensure proper robots.txt configuration and more.

Ready to optimise your crawl budget? Let’s run a free SEO analysis to identify which pages are wasting your Google crawl allowance.

These articles will walk you through the basics of directing search engines to your most important content.

seo-kenya-example
Real Kenya business robots.txt example blocking admin pages while allowing product content.
seo-before-after
Before and after comparison showing improved crawl efficiency with proper robots.txt configuration.

Have more SEO questions? Our SEO FAQs Kenya page answers the most common ones.

Frequently Asked Questions

What does a robots.txt file do?

It tells search engines which pages to crawl or ignore, helping them focus on important content.

Where should I place robots.txt?

In your site’s root directory, like yoursite.co.ke/robots.txt, so Google finds it easily.

Can robots.txt boost my Kenya rankings?

Yes, by directing crawlers to key pages like ‘M-Pesa payment Kenya’ or ‘Nairobi delivery services’ faster.

Should I block my admin pages?

Yes, always block admin pages like /login/ to prevent unwanted crawling and security risks.

seo-audit-kenya-cta
AM Digital KE SEO audit call-to-action for robots.txt optimization services.
Click me to learn SEO