SEOHack.AI
Technical SEO

Robots.txt SEO Guide: Complete Guide for 2026

Learn robots.txt syntax, directives, crawler controls, common mistakes and how to audit robots.txt correctly.

Published August 2026
Updated August 2026
12 min read
Chapter 6

Robots.txt: Control Search Engine Crawling

The robots.txt file provides instructions to automated crawlers about which URL paths they may request on your website. It is one of the first technical files that should be checked when investigating crawlability.

A correctly configured robots.txt file can help prevent unnecessary crawling of certain URL patterns. However, it should be used carefully because blocking a URL in robots.txt does not mean that the URL can never appear in search results.

Important Distinction

Robots.txt controls crawler access to URL paths. It is not a general mechanism for removing a page from Google's index. If you need a page removed from search results, use the appropriate indexing and removal mechanisms instead.

Where Is robots.txt Located?

The robots.txt file is normally located at the root of a website.

https://example.com/robots.txt

For example, if your website is example.com, the crawler instructions should be available from the root domain rather than inside a subdirectory.

Basic robots.txt Syntax

User-agent: *
Allow: /

Sitemap: https://example.com/sitemap.xml

The User-agent directive identifies the crawler to which the rules apply. The Allow directive specifies paths that may be crawled, while the Sitemap directive can provide the location of your XML sitemap.

Common robots.txt Directives

DirectivePurpose
User-agentSpecifies which crawler a rule applies to.
DisallowRequests that specified URL paths should not be crawled.
AllowAllows access to specified paths when applicable.
SitemapProvides the URL of an XML sitemap.

Example: Blocking an Administrative Directory

User-agent: *
Disallow: /admin/

This requests that crawlers do not crawl URLs under the /admin/ path. The exact rules required by a website depend on its architecture and which resources should be accessible to crawlers.

Common robots.txt Mistakes

Blocking Important Content

Accidentally disallowing important sections can prevent crawlers from accessing URLs you want them to discover.

Blocking the Entire Website

A broad Disallow rule can unintentionally restrict crawling across the entire site.

Using robots.txt for Noindex

Robots.txt should not be treated as a replacement for page-level indexing controls.

Incorrect Sitemap URL

A sitemap directive pointing to the wrong location reduces its usefulness.

Testing Only the Homepage

A robots.txt file can look harmless while still blocking important directories or URL patterns.

Ignoring URL Patterns

Parameter and path patterns should be reviewed carefully before adding broad crawl restrictions.

robots.txt Audit Checklist

robots.txt exists at the root of the domain
The file is accessible to crawlers
Important content is not unintentionally blocked
The website is not globally disallowed
Administrative or unnecessary paths are reviewed
Sitemap URL is correct
Rules match the current website architecture
Changes are tested before deployment
💡

SEOHACK Tip

Always review robots.txt after a website migration, CMS change, redesign or major plugin installation. A single overly broad rule can affect the crawlability of an entire section of a website.

Related Technical SEO Guides

Continue learning with these related Technical SEO resources.

Free SEO Audit

Ready to Improve Your
Google & AI Rankings?

Analyze your website in under 60 seconds and receive a professional SEO report with Technical SEO, AI SEO, Performance, GEO, AEO and actionable recommendations.

190+ SEO Checks
AI SEO Score
Technical SEO Analysis
Performance Analysis
Priority Fixes
Instant Report

SEOHACK Editorial Team

The SEOHACK Editorial Team creates practical, research-driven content focused on Technical SEO, AI SEO, Generative Engine Optimization (GEO), Answer Engine Optimization (AEO), Local SEO, Performance Optimization and website growth.

AI SEOTechnical SEOGEOPerformance
KEEP LEARNING

Related Articles

Continue improving your SEO with these in-depth guides.

AI SEO

How to Rank in Google AI Overviews

10 min read
Read Article
Technical SEO

Ultimate Technical SEO Checklist

11 min read
Read Article