Not Every Crawler Obeys
The rules are voluntary. Google and other reputable crawlers follow them; others may not. Protect anything sensitive with a password instead.
A robots.txt file is a short text file at the root of your website that tells search engine crawlers which addresses they may visit. Used well, it keeps Google away from endless filter pages and spares your server. Used badly, it can hide your whole site. This guide explains Google's own robots.txt rules in plain English.
Google's crawlers read your robots.txt file before they crawl your site. Its main job is to manage crawler traffic so your server is not overloaded and crawlers do not waste time on pages that do not matter. Google is firm that it is not a way of keeping a web page out of search results. The effect depends on the type of file being blocked.
| File type | What blocking it does | Watch out for |
|---|---|---|
| Web pages (HTML, PDF and other readable formats) | Saves crawling on unimportant or duplicate pages and reduces load | A blocked page can still appear in results as a bare address with no description |
| Images, video and audio | Keeps those files out of Google's results and manages traffic | Other people can still link to the files directly |
| Resource files (scripts, styles, decorative images) | Saves crawling if pages still work without them | Do not block files Google needs to understand the page |
If your site runs on a hosted system such as Wix or Blogger, you may not be able to edit robots.txt at all. Look for a search or SEO settings page instead, which controls the same thing.
What this means for you: for most business sites the file should be short and mostly permissive. If you want a page out of Google, the right tool is a noindex rule, explained in meta tags and noindex, or the steps in removing pages from Google.
Every part of the SEO tips, on one map. The page you are reading is highlighted.
Google lists three limits worth knowing before you rely on the file.
The rules are voluntary. Google and other reputable crawlers follow them; others may not. Protect anything sensitive with a password instead.
Different crawlers may understand the syntax in slightly different ways. Check the correct way to address each crawler you care about.
If other sites link to a blocked address, Google can still index it. Use noindex, a password or a removal request to keep it out.
Google also warns that mixing crawling rules and indexing rules can make them cancel each other out. The classic mistake: blocking a page in robots.txt and adding noindex to it. Google cannot crawl the page, so it never sees the noindex. The page stays in results as a bare address.
The file must be called robots.txt (the name is case-sensitive) and sit in the top folder of the site. Google reads it over HTTP, HTTPS or FTP. Crucially, the rules only apply to the exact host, protocol and port where the file lives.
| File address | Covers | Does not cover |
|---|---|---|
| https://example.com/robots.txt | Everything on https://example.com/ | Other subdomains, the http version, or a non-standard port such as :8181 |
| https://www.example.com/robots.txt | Only www.example.com | example.com without www, or deeper subdomains such as shop.www.example.com |
| https://example.com/folder/robots.txt | Nothing: crawlers never look in subfolders | The whole site |
| https://example.com:443/robots.txt | https://example.com/ as well, because 443 is the default port | Other ports such as :444 |
| A file on an IP address | Only requests to that IP address | The domain name, even if it runs on that IP |
Web addresses using accented letters count as the same site as their encoded (punycode) version. An FTP file only covers FTP addresses.
What this means for you: if your site answers on both www and non-www, or still on http, each version needs its own file, or better, one version should redirect to the other. That set-up is one of the checks in the search settings part of the launch checklist.
The file is plain text, saved as UTF-8, with one rule per line in the form field: value. Field names are not case-sensitive, but the paths you block are. Anything after a # is a comment. Google reads up to 500 KiB and ignores anything beyond that, so keep it lean; moving blocked content into one folder lets one line do the work of many. Lines Google cannot understand are skipped, including a stray byte order mark at the start.
* means all crawlers./; an empty value is ignored.# Keep crawlers out of internal search results
User-agent: *
Disallow: /search/
Allow: /search/help/
Sitemap: https://www.example.com/sitemap.xml
Google does not support other fields. In particular, crawl-delay is ignored. Our sitemaps guide explains the other ways to submit a sitemap.
Rules sit in groups, each starting with one or more user-agent lines. A crawler follows only one group: the one whose user-agent matches it most specifically. Every other group is ignored, including the general * group. The order of groups in the file does not matter, and version numbers or extra text after the name are ignored, so googlebot/1.2 counts as googlebot.
Take a file with three groups: one for googlebot-news, one for * and one for googlebot. Googlebot News follows the first, even when it is crawling images. Normal Googlebot follows the third. Storebot-Google has no group of its own, so it follows the * group, as does any other crawler. Related crawlers only match a group if they are named in it.
* group. If Googlebot has its own group, your general rules do not apply to it.What this means for you: adding a Googlebot group to "just allow one folder" can quietly lift every restriction in your general group. Repeat the rules you still need inside the new group. More about Google's crawlers is in the three kinds of Google crawler.
Paths are matched from the start of the address and are case-sensitive. Google compares them in their encoded form, so a rule written with a special character matches the same address written with percent codes. Two wildcards are supported: * means any run of characters, and $ means the end of the address.
| Rule path | Matches | Does not match |
|---|---|---|
| / | The whole site | Nothing is left out |
| /$ | Only the home page | Every other address |
| /fish (same as /fish*) | /fish, /fish.html, /fish/salmon.html, /fishheads, /fish.php?id=anything | /Fish.asp, /catfish, /?id=fish, /desert/fish |
| /fish/ | /fish/, /fish/?id=anything, /fish/salmon.htm | /fish, /fish.html, /animals/fish/ |
| /*.php | Any address containing .php, including /folder/filename.php?parameters | / and /windows.PHP |
| /*.php$ | Addresses ending in .php | /filename.php?parameters, /filename.php5 |
| /fish*.php | /fish.php, /fishheads/catfish.php?parameters | /Fish.PHP |
A trailing * adds nothing, so /* is the same as /. The difference between /fish and /fish/ catches a lot of people out: the first also blocks /fishheads.
When more than one rule matches an address, Google uses the most specific one, meaning the rule with the longest path. If two matching rules are equally specific, the least restrictive one wins, which means allow.
| Address | Rules | Result |
|---|---|---|
| /page | allow: /p and disallow: / | Allowed: /p is longer |
| /folder/page | allow: /folder and disallow: /folder | Allowed: a tie goes to allow |
| /page.htm | allow: /page and disallow: /*.htm | Blocked: /*.htm is longer |
| /page.php5 | allow: /page and disallow: /*.ph | Allowed: a tie goes to allow |
| / (home page) | allow: /$ and disallow: / | Allowed: /$ is more specific |
| /page.htm | allow: /$ and disallow: / | Blocked: /$ only matches the home page |
What this means for you: test any change before you publish it. One misplaced Disallow: / blocks the entire site, and checking the file is part of every technical SEO audit.
What your server sends back when Google asks for robots.txt matters as much as what is in it.
Google reads the file as it is. If the server sends an HTML page instead, Google tries to pull rules out of it and ignores the rest.
Google follows at least five redirects, then treats it as missing. Meta refresh and JavaScript redirects are not followed.
Any 4xx except 429 means "no file", so everything may be crawled. Do not use 401 or 403 to limit crawling; it does not work.
For 12 hours Google stops crawling the site. For up to 30 days it uses the last good copy. After that it carries on as if there were no file if the site works, or keeps holding back if the site is down.
Network problems such as timeouts and dropped connections are treated as server errors. Google normally caches the file for up to 24 hours, longer if it cannot fetch a fresh copy, and a Cache-Control max-age header can change that. The cached copy may be shared between Google's crawlers. Robots.txt does not apply to fetches a person triggers themselves, such as a feed reader, or to crawlers that check for malware.
What this means for you: a robots.txt that sometimes throws server errors can pause crawling of your whole site. Reliable UK web hosting avoids that, and the Googlebot and crawling guide covers what to do when crawling goes wrong.
Google's own advice on URL structure names the pages most worth blocking: internal search results, calendars and other endless spaces, and the sort and filter addresses that shops and listings pages create. These can multiply into thousands of near-identical URLs that soak up crawling time. Block them for the long term; Google advises against changing robots.txt often to shuffle crawling between sections.
User-agent: *
Disallow: /search
Disallow: /*?sort=
Disallow: /*?filter=
Disallow: /calendar/
Before you block, make sure none of these addresses are pages you actually want found, and that each real page has a clean address of its own. The guide to URL mistakes that create duplicate pages explains how these addresses appear, and the canonical URLs guide covers duplicates you cannot block.
What this means for you: if you run an online shop, this is where robots.txt earns its keep, and it is part of my ecommerce SEO set-up. For the other guides in this series, see the SEO tips map.
Based on Google Search Central documentation: Introduction to robots.txt, How Google interprets the robots.txt specification, URL structure best practices for Google Search, Troubleshoot Google Search crawling errors, Reduce the Google crawl rate. Licensed under CC BY 4.0. Rewritten in plain English by Willis Web Design; last checked 13 October 2026.
Questions
Not reliably. Robots.txt controls crawling, not indexing. If other websites link to a blocked page, Google can still show its address in results, usually with no description. To keep a page out of Google, let it be crawled and add a noindex rule, protect it with a password, or remove it. Blocking it in robots.txt as well would stop Google seeing the noindex at all.
Nothing bad. If Google asks for the file and gets a 404 or another 4xx error (apart from 429), it assumes there are no restrictions and crawls everything it can find. Many small sites manage fine that way. Even so, a simple file that allows everything and lists your sitemap is good practice, and every site I build has one as standard.
No. Google does not support the crawl-delay line, so it is ignored. Using 401 or 403 errors to limit crawling does not work either. If Googlebot is overloading your server in an emergency, the right move is to return 503 or 429 responses for a short time. The Googlebot guide on this site explains how to do that safely without losing pages from the index.
Google usually caches the file for up to 24 hours, so changes can take about a day to take effect. It can be longer if Google cannot fetch a fresh copy because of timeouts or server errors. A Cache-Control max-age header can also lengthen or shorten that time. If you have unblocked something important, give it a day before checking again in Search Console.
Usually not. Google needs your style sheets and scripts to see the page the way a visitor does. Google says you can block resource files only if your pages still make sense without them. Blocking files that the page needs to display properly can make it harder for Google to understand your content, which can hurt how the page performs in search.
No. The file is public, anyone can read it, and listing a private folder there actually tells people where it is. Well-behaved crawlers follow the rules, but nothing forces other bots to obey. For anything sensitive, such as client areas or staff documents, use proper password protection on the server. Robots.txt is for managing crawler traffic, not for security.
Next step
See where your website stands, free.
Run a free test of your current site, or call me for a straight answer about what you need.