Skip to content

Robots.txt Explained: Controlling How Google Crawls Your Kenyan Website

Robots.txt – technology event in Sandton, Johannesburg, South Africa
Photo: Slippery slope302, CC BY 4.0, via Wikimedia Commons

Here’s a scenario that happens more often than you’d think: a Kenyan business owner spends months building a website, launches it, waits for traffic, and nothing shows up on Google — not even a search for the exact business name. Nine times out of ten when this happens, the culprit is a tiny, easy-to-overlook file called robots.txt.

It’s a plain text file sitting at the root of your domain — something like buydomainkenya.co.ke/robots.txt — and it gives instructions to search engine crawlers (Google, Bing, and others) about which parts of your site they’re allowed to visit and index. Get it wrong, and you can accidentally tell Google to ignore your entire website.

What robots.txt actually does

When Googlebot arrives at your website, the very first thing it checks is the robots.txt file. It’s essentially a set of rules that says “you can look here” or “please don’t look there.” A simple example looks like this:

Advertisement
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

This tells all crawlers (“User-agent: *”) to stay out of the WordPress admin area, except for one specific file needed for the site to function properly. That’s a healthy, normal setup.

The mistake that kills your Google traffic

The dangerous version looks like this:

User-agent: *
Disallow: /

That single forward slash after “Disallow:” tells every search engine to stay away from your entire site — every page, every product, every blog post. This often happens by accident during website development: a developer sets this rule while building the site on a staging server (so Google doesn’t index an unfinished site), and then forgets to remove it when the site goes live.

If you’ve launched a website and it’s simply not appearing anywhere on Google after a few weeks, checking your robots.txt file should be one of your first steps. Just type yourwebsite.co.ke/robots.txt into your browser and see what comes up.

What you should typically allow and block

For most Kenyan business websites running WordPress, the goal is simple: let Google see your actual content — homepage, blog posts, product pages, service pages — and keep it away from backend and duplicate content areas.

Advertisement
  • Block: /wp-admin/, internal search result pages, staging or test subdomains, thank-you pages after checkout
  • Allow: your homepage, blog, product and service pages, images you want to appear in Google Images

You generally do not need to block your CSS or JavaScript files anymore — modern Google needs to load these to understand how your page looks and functions, and blocking them can actually hurt your search rankings.

Add your sitemap to the file

A well-built robots.txt file usually ends with a line pointing to your XML sitemap, which helps search engines discover all your pages faster:

Sitemap: https://yourwebsite.co.ke/sitemap.xml

If you’re using an SEO plugin like Yoast or Rank Math on WordPress, this sitemap is usually generated automatically — you just need to make sure the line is included in robots.txt.

How to check and edit yours

If your site runs on WordPress with an SEO plugin installed, you can usually edit robots.txt directly from the plugin’s settings without touching any code — Yoast SEO, for example, has a robots.txt editor under Tools. If you manage the site through cPanel, you can also edit the file directly via the File Manager, in the public_html folder.

After making changes, use Google Search Console’s robots.txt tester (under the old version, or the URL Inspection tool in the newer version) to confirm your important pages are marked as allowed, not blocked.

A quick gut check

  1. Visit yourdomain.co.ke/robots.txt in your browser
  2. Confirm there’s no blanket “Disallow: /” blocking your whole site
  3. Confirm your sitemap URL is listed
  4. Confirm sensitive areas like /wp-admin/ are blocked

It takes five minutes to check, and catching a misconfigured robots.txt file early can save you months of invisible-to-Google frustration. If you’re setting up a new site and want a hosting environment where these SEO fundamentals are easy to manage from day one, have a look at our WordPress-ready hosting plans.

Advertisement

A word of caution before you edit it yourself

Robots.txt is a small file, but it carries real weight — a single misplaced character can undo months of SEO work. If you’re not confident editing it directly, most SEO plugins offer a guided editor that reduces the risk of typos. And after any change, always re-check the live file in your browser rather than trusting that the save button worked as expected. It’s a two-minute habit that can save you weeks of wondering why your traffic suddenly dropped.

Advertisement

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat now