🤖 TECHNICAL SEO GUIDE Robots.txt Guide Write, test, and audit your robots file without blocking your own site Updated 2026

Your robots.txt file is a plain text file that lives at the root of your domain, https://example.com/robots.txt, and acts as a set of instructions for search engine crawlers. It tells bots like Googlebot which pages and directories are open for crawling and which should be left alone.

Robots.txt is simple by design, but that simplicity is deceptive. A single misconfigured line can block your entire site from being crawled, a catastrophic mistake that may not surface in rankings for days or weeks. This guide covers the full syntax, what to block (and what not to), how robots.txt interacts with noindex, how to test your file, and the six most common mistakes to avoid.

Robots.txt Syntax

Robots.txt uses a simple directive-based syntax. Each “record” in the file specifies a user agent and then a set of rules that apply to it. Rules are evaluated in order, and the most specific match wins.

Core Directives

User-agent

Specifies which crawler the following rules apply to. Use * (wildcard) to target all crawlers, or name a specific bot.

User-agent: * # applies to all crawlers
User-agent: Googlebot # applies only to Google's main web crawler User-agent: Bingbot # applies only to Microsoft Bing's crawler

Disallow

Tells the specified crawler not to crawl matching paths. An empty Disallow: means “allow everything.” Paths are case-sensitive and support wildcard * and end-of-string anchor $ patterns.

Disallow: /wp-admin/ # blocks the entire /wp-admin/ directory
Disallow: /search/ # blocks the /search/ path and all sub-paths Disallow: /?s= # blocks any URL containing ?s= (WordPress search) Disallow: /.pdf$ # blocks any URL ending in .pdf

Allow

Explicitly permits crawling of a path even when a broader Disallow rule would block it. Used to carve out exceptions. Allow is evaluated before Disallow when both match the same URL.

User-agent: *
Disallow: /wp-admin/ Allow: /wp-admin/admin-ajax.php # allow this specific file within the blocked dir

Sitemap

Points crawlers to your XML sitemap. Place this at the end of your robots.txt file. You can list multiple sitemaps if you have more than one.

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

Crawl-delay

Crawl-delay tells a crawler to wait N seconds between requests. While supported by Bingbot and others, Googlebot ignores it entirely, Google manages crawl rate through Search Console settings instead. Avoid using crawl-delay as a performance fix; it won’t help with Google and can slow Bing’s indexation unnecessarily. Address server performance issues at the infrastructure level instead.

Full Example: WordPress Site Robots.txt

A well-configured robots.txt for a typical WordPress site looks like this:

# Robots.txt for example.com
Last updated: 2026User-agent: *

Block admin and login areas

Disallow: /wp-admin/ Disallow: /wp-login.php

Block internal search results

Disallow: /?s= Disallow: /search/

Block user account / profile pages

Disallow: /my-account/ Disallow: /cart/ Disallow: /checkout/ Disallow: /order-received/

Block staging and utility directories

Disallow: /wp-json/ Disallow: /xmlrpc.php

Allow Googlebot to access admin-ajax (needed for some functionality)

Allow: /wp-admin/admin-ajax.php

Sitemap location

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

What to Block in Robots.txt

The purpose of robots.txt is to prevent crawlers from wasting time on URLs that have no value in search results, and to protect pages that should never be publicly indexed. Here are eight categories to block on most sites.

1. Admin Areas

Your CMS admin interface and login pages are not meant for public access and have no search value. Blocking them also reduces the attack surface for bots scanning for vulnerable login endpoints.

Disallow: /wp-admin/
Disallow: /wp-login.php Disallow: /admin/ Disallow: /administrator/ # Joomla Disallow: /user/login # Drupal

2. Search Result Pages

Internal search result pages (e.g. /search/?q=shoes) are typically thin, low-quality content that can consume significant crawl budget on large sites. They also create near-infinite duplicate content since every search query generates a new URL.

Disallow: /search/
Disallow: /?s= # WordPress search parameter Disallow: /?q= # generic search parameter

3. Thank-You and Confirmation Pages

Post-conversion pages (order confirmations, form submission success pages) have no value in search results. They often contain personal or transactional content, and indexing them can cause confusing Google results for users who search your brand.

Disallow: /thank-you/
Disallow: /order-received/ Disallow: /checkout/order-received/

4. Staging and Test Directories

Any staging content, development pages, or test directories that are accidentally accessible on your production domain should be blocked. Better still, move staging to a subdomain with HTTP auth, but robots.txt is a useful second layer of protection.

Disallow: /staging/
Disallow: /test/ Disallow: /dev/

5. Duplicate Content from URL Parameters

Faceted navigation and filtering systems generate huge numbers of parameter-based URLs, often tens of thousands on e-commerce sites. Blocking common filter parameters prevents this duplicate content from being crawled at scale.

Disallow: /*?color=
Disallow: /?size= Disallow: /?sort= Disallow: /?ref= # referral tracking parameters Disallow: /?sessionid=

6. User Profile and Account Pages

Logged-in user pages, account dashboards, order history, saved addresses, contain personal data and provide no public search value. Block the entire account section.

Disallow: /my-account/
Disallow: /account/ Disallow: /profile/ Disallow: /members/

7. Cart and Checkout Pages

Shopping cart and checkout flows are transactional, session-specific pages with no search value. They can also cause issues if Google indexes them and users land on an empty cart or broken checkout flow.

Disallow: /cart/
Disallow: /checkout/ Disallow: /basket/

8. Internal Search Results

Distinct from blocking the search URL pattern, also block any URL that aggregates search results through faceted navigation on category or tag pages with multiple active filters. These are some of the most prolific sources of crawl budget waste on content-heavy sites.

Disallow: /tag/
Disallow: /?tag= Disallow: /category/?filter=

What NOT to Block

These five categories are accidentally blocked more often than you’d expect, and each one can meaningfully damage your rankings.

1. CSS and JavaScript Files

This is the most damaging accidental block. Googlebot uses a headless browser to render your pages and evaluate them. If you block your CSS and JavaScript files, whether via a blanket directory block or by restricting Googlebot specifically, Google cannot render your pages correctly. It sees a broken, CSS-less, JavaScript-free version of your site. This can tank your Core Web Vitals scores, cause pages to appear thin (since dynamic content isn’t rendered), and trigger mobile usability issues. Never block /wp-content/, /assets/, /static/, or /js/ directories.

2. Product and Category Pages

When trying to block faceted navigation or filter parameters, it’s easy to write an overly broad rule that also blocks your real product and category pages. Test every disallow rule carefully, a Disallow: /category/ rule that looks like it targets one thing can block your entire category taxonomy if your URLs aren’t structured the way you think they are.

3. Image Directories

Blocking image directories prevents Google Images from indexing your images. For sites that rely on image search traffic, photographers, e-commerce stores with product images, recipe sites, this can eliminate a meaningful traffic source. Also, Googlebot needs access to images to evaluate page quality and rendering. Never block /wp-content/uploads/ or /images/.

4. Your Sitemap URL

It sounds obvious, but a blanket disallow rule can accidentally block your sitemap if the sitemap URL pattern matches. For example, Disallow: /*.xml intended to block XML data feeds would also block /sitemap.xml. Always verify your sitemap URL is accessible after changing robots.txt.

5. The Entire Site

The nuclear option: Disallow: / under User-agent: * blocks every crawler from crawling every page. This is sometimes added accidentally, during a site migration, by a developer testing the file, or by a plugin that writes a default robots.txt. Check your robots.txt immediately after any major site change or plugin installation.

# CATASTROPHIC, never do this on a live site
User-agent: * Disallow: /

Robots.txt vs Noindex, Key Difference

This distinction matters enormously in practice and is misunderstood by many site owners. Robots.txt controls crawling. Noindex controls indexing. These are two completely different things.

When you block a page in robots.txt, you prevent Google from crawling it, but Google can still discover the URL (from links on other pages or the sitemap) and may still index it as an empty result, showing just the URL and no description. Blocking a page in robots.txt does not guarantee it won’t appear in search results.

The noindex meta tag (<meta name="robots" content="noindex">) tells Google not to show the page in search results, but Google must be able to crawl the page to see the noindex tag. A page that’s blocked in robots.txt and has a noindex tag: Google can’t crawl it, so it never sees the noindex tag, so the blocking effect comes only from robots.txt (which only stops crawling, not indexing).

Robots.txt Disallow Noindex Meta Tag Stops crawling? Yes No, Google still crawls the page Stops indexing? Not guaranteed, URL can still appear in results Yes, removes page from Google’s index Conserves crawl budget? Yes, bot never visits the page No, bot still crawls to read the tag Use for Admin pages, parameter URLs, crawl budget management, pages you want to stay out of the crawl queue Low-quality pages, duplicate content, thank-you pages, pages you want out of search results Can combine? Only when you want to prevent crawling AND indexing, but noindex won’t be seen if page is blocked by robots.txt

Practical rule: Use robots.txt to save crawl budget and protect admin/system pages. Use noindex to remove specific pages from search results while still allowing them to be crawled (so Google can see the tag). For pages like duplicate parameter URLs, use canonical tags as the primary deduplication signal, with optional robots.txt blocking for crawl budget savings.

How to Test Your Robots.txt

Never make changes to robots.txt without testing. One misplaced directive can have site-wide consequences.

Method 1, Google Search Console Robots.txt Tester

  1. Open Google Search Console for your property.
  2. Navigate to Settings → robots.txt (or go directly to the legacy URL Inspection for robots.txt if visible in your account).
  3. The tester shows your current robots.txt content. Enter any URL on your site in the test field and select a user agent (Googlebot, Googlebot-Mobile, etc.).
  4. The tool will tell you whether that URL is Allowed or Blocked by your current rules, and which specific rule is responsible.
  5. Test your most important pages (homepage, category pages, top product pages, blog posts) to verify they’re all allowed. Test your intended blocked paths to verify they are blocked.

Method 2, Direct URL Check

Your robots.txt file must be publicly accessible at the root of your domain. Visit https://yourdomain.com/robots.txt directly in your browser. If it returns a 404, your robots.txt is missing, which means no crawl restrictions are in place (Google will crawl everything). If it returns content, verify the rules match what you expect.

Method 3, Google Search Console URL Inspection

For any specific URL you suspect might be accidentally blocked:

  1. Open Google Search Console and paste the URL into the search bar at the top.
  2. Run the URL Inspection tool.
  3. If the page is blocked by robots.txt, the tool will display a “URL is not available to Google” warning with the specific reason.
  4. Click “Test Live URL” to check the current state (not cached data).

Method 4, robots.txt Tester Tools

Third-party tools like Screaming Frog include a built-in robots.txt checker. In Screaming Frog, go to Configuration → robots.txt to view the active rules and test specific URLs. Ahrefs Webmaster Tools also flags pages blocked by robots.txt in its site audit report.

Common Robots.txt Mistakes

These six mistakes are the most frequently found in technical SEO audits, and several of them can cause immediate, severe ranking impacts.

Mistake 1: Blocking the Entire Site with Disallow: /

# WRONG, blocks every page for every bot
User-agent: * Disallow: /

RIGHT, only block specific paths

User-agent: * Disallow: /wp-admin/ Disallow: /wp-login.php

This is the most catastrophic robots.txt error. WordPress accidentally creates this configuration when you enable “Discourage search engines from indexing this site” in Settings → Reading. Always check this setting after any WordPress installation or migration.

Mistake 2: Blocking CSS and JavaScript

# WRONG, prevents Google from rendering pages
User-agent: * Disallow: /wp-content/

RIGHT, only block specific upload paths if needed

User-agent: * Disallow: /wp-content/cache/ Disallow: /wp-content/backup-files/

Allow /wp-content/themes/ and /wp-content/plugins/ (leave them unblocked)

Mistake 3: Forgetting the Trailing Slash on Directories

# WRONG, "Disallow: /wp-admin" also blocks /wp-admin-tools/, /wp-admin-backup/ etc.
Disallow: /wp-admin

RIGHT, trailing slash restricts the block to exactly that directory

Disallow: /wp-admin/

Without a trailing slash, the Disallow rule will match any URL that starts with that string, which may be broader than you intend. Always include trailing slashes when blocking directories.

Mistake 4: Using Robots.txt to Remove Pages from Search Results

# WRONG, blocking pages in robots.txt does not remove them from Google's index
User-agent: * Disallow: /duplicate-page/

RIGHT, to remove a page from search results, use noindex (and allow crawling)

On the page itself, in the <head>:

<meta name=”robots” content=”noindex, follow”>

Mistake 5: Sitemap URL Not Listed or Listed with Wrong Protocol

# WRONG, relative URL (robots.txt requires absolute URLs for Sitemap)
Sitemap: /sitemap.xml

WRONG, http protocol when site is HTTPS

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

RIGHT, absolute URL with correct protocol

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

Mistake 6: Conflicting Allow/Disallow Rules Without Understanding Priority

# AMBIGUOUS, which rule wins for /wp-admin/admin-ajax.php?
User-agent: * Allow: /wp-admin/admin-ajax.php Disallow: /wp-admin/

Answer: Allow wins because it’s more specific (longer matching path)

CLEAR APPROACH, put Allow before Disallow and use specific paths

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

Googlebot resolves conflicts between Allow and Disallow rules by selecting the most specific (longest) matching rule. If two rules have equal specificity, the Allow rule takes precedence. Understanding this prevents accidental over-blocking.

Frequently Asked Questions

Does blocking a page in robots.txt remove it from Google’s index?

No. Robots.txt only prevents crawling. A blocked page can still appear in Google’s search results if Google discovers the URL from links on other pages. The search result may show just the URL with no description (since Google couldn’t crawl the content). To actually remove a page from search results, use a noindex meta tag, but the page must be crawlable for Google to see the tag. For pages already indexed that you want removed, use Google Search Console’s URL Removal Tool as a temporary measure while adding noindex.

What happens if my robots.txt returns a 404?

Google treats a missing robots.txt (404 response) as “no restrictions”, Googlebot will crawl your entire site. This is different from a 500 server error, which Google treats cautiously by slowing or stopping its crawl until the file is accessible again. A missing robots.txt isn’t catastrophic, but you lose the ability to control crawl behavior and protect admin paths. Make sure your robots.txt always returns a 200 status code.

How quickly does Google pick up changes to robots.txt?

Google typically re-crawls robots.txt files every 24 hours, though this can vary from a few hours to a few days. After making a change, especially if you’re unblocking previously blocked content, you can use the URL Inspection tool in Google Search Console to request a recrawl of specific URLs. For urgent removals, use the URL Removal Tool in Search Console, which processes within hours.

Should I create separate rules for Googlebot and Bingbot?

Only if you have a specific reason to treat them differently. Most sites should use User-agent: * for all rules, which applies to every crawler uniformly. Create bot-specific rules only when you have intentional differences, for example, allowing Google Images but not Bing Images to access a specific directory, or applying stricter rate-limiting to a scraper bot you’ve identified.

Can robots.txt protect sensitive data on my site?

No. Robots.txt is a public file, anyone can read it (including malicious actors) to discover which directories you’re trying to hide. It also only controls well-behaved bots. Malicious crawlers and scrapers ignore robots.txt entirely. Never rely on robots.txt to protect sensitive data. Use proper authentication, server-level access controls, and keep truly sensitive systems off your public domain entirely.

Related Resources

Technical SEO Guide Complete reference for crawlability, indexation, speed, and site structure Technical SEO Audit Step-by-step process for finding and fixing technical SEO issues Canonical Tags Guide How to use rel=”canonical” correctly, rules, mistakes, and audit steps SEO Audit Checklist 60-point checklist covering technical SEO, content, Core Web Vitals, and more

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com