robots.txt and meta robots tags, explained
robots.txt and meta robots tags do different jobs and are routinely confused. robots.txt tells crawlers where not to spend time; meta robots tells them what not to store. Mixing the two up is how sites accidentally deindex themselves or leak admin URLs into search results. Covers the correct syntax, a real example file, and what a small business site should and should not block.
robots.txt is one of the oldest files on the web and one of the most misunderstood. It is a plain text request to well-behaved crawlers, not a lock. Anything you put in it that you actually need hidden from people, not just search engines, is in the wrong tool.
The confusion that causes real damage is treating robots.txt and the noindex meta tag as interchangeable. They are not. One stops a crawler from fetching a page. The other stops a page from appearing in results. Using the wrong one for the job either leaks a URL you wanted hidden or, worse, blocks Google from ever seeing the noindex tag that would have removed a page properly.
What robots.txt actually does
robots.txt sits at the root of a domain, for example example.com/robots.txt, and gives instructions to crawlers before they request anything else on the site. It is a crawling directive, not a security mechanism and not an indexing mechanism.
Two things follow from that. First, it is a suggestion. Google, Bing and other major search engines respect it, but plenty of scrapers and bad actors ignore it entirely, so anything genuinely sensitive, a customer database export, an internal API key, an unlaunched product page, needs to sit behind authentication, not behind a Disallow line. robots.txt is public: anyone can read it at yourdomain.com/robots.txt, which means it can also hand an attacker a map of the folders you'd rather they not look at.
Second, disallowing a URL in robots.txt does not guarantee it stays out of Google's index. If other sites link to a blocked URL, Google can still show it in results, usually as a bare URL with no title or description, because it was never allowed to crawl the page to read a noindex tag or generate a snippet. This is the single most common misunderstanding about the file.
robots.txt syntax
The file is plain text, one directive per line, grouped under a User-agent line. A group applies to whichever crawler matches that user-agent, and an asterisk matches all of them.
The core directives are simple, but the matching rules trip people up. Disallow and Allow match by path prefix, and the most specific matching rule wins, not the first one listed. A trailing slash matters: Disallow: /search blocks /search and /search-results, while Disallow: /search/ only blocks paths under that folder.
- User-agent: which crawler the group applies to (* for all, or a specific bot like Googlebot).
- Disallow: a path prefix the crawler should not request.
- Allow: an exception carving a path back out of a broader Disallow, useful for allowing one file inside a blocked folder.
- Sitemap: an absolute URL to your XML sitemap. This directive is global and can sit anywhere in the file, not just under a user-agent group.
- $ end-of-string anchor and * wildcard are supported by Google and Bing for pattern matching, for example Disallow: /*.pdf$ to block all PDFs.
A real example robots.txt
This is roughly what a small business site on WordPress or a similar CMS should ship. Adjust the folder names to match your platform, but the shape holds.
- User-agent: *
- Disallow: /wp-admin/
- Allow: /wp-admin/admin-ajax.php
- Disallow: /search/
- Disallow: /*?s=
- Disallow: /*?add-to-cart=
- Disallow: /*?sort=
- Disallow: /*?filter=
- Disallow: /cart/
- Disallow: /checkout/
- Disallow: /thank-you/
- Disallow: /*?utm_
- Sitemap: https://www.example.com/sitemap.xml
When to use noindex instead
Use a meta robots noindex tag, placed in the page's head as <meta name="robots" content="noindex">, when you want a page kept out of search results but you still want it crawled. Crawling has to be allowed, because Google can only obey a noindex tag if it is permitted to fetch the page and read it.
This covers most of the pages people reach for robots.txt first: thank-you pages after a form submission, internal search result pages, thin tag or author archive pages, staging content that accidentally shipped to production, duplicate print or PDF versions of a page that already exists as HTML. In each case the page needs to exist and be reachable, it just should not compete for a place in results.
The reverse combination, noindex plus Disallow on the same URL, quietly breaks things. Google cannot recrawl a blocked page to notice the noindex tag went away, and it cannot always drop an already-indexed page from results if it is blocked from rechecking it. If a page must come out of the index, allow crawling, add noindex, wait for Google to process it via Search Console's URL Inspection tool, then block it in robots.txt afterward if you want to save crawl budget going forward.
X-Robots-Tag is the HTTP-header equivalent of meta robots, useful for non-HTML files like PDFs where you cannot inject a meta tag. It goes in the server response header and works the same way: it needs crawling allowed to take effect.
What a small business site should typically block
None of these need to be indexed and most add nothing to what a crawler already understands about your site, so keeping them out of the crawl queue is pure upside for crawl efficiency.
- Admin panels and login screens: /wp-admin/, /admin/, /login/. Not for security, that is what authentication is for, but there is no reason to spend crawl budget on them.
- Internal search results: /search/ or ?s= parameters generate a page for every query a visitor has ever typed, most of them near-duplicates of your real content, which is a classic source of index bloat.
- Filtered and faceted navigation: ?color=, ?size=, ?sort=, ?price= on ecommerce or listing sites can multiply a few hundred products into hundreds of thousands of crawlable URL combinations, almost all of them duplicate or near-duplicate content.
- Thank-you and confirmation pages: /thank-you/, /order-confirmation/. These only make sense in the context of just having submitted a form, so a stranger landing on one from search is a poor and occasionally embarrassing experience.
- Cart, checkout and account pages: session-specific, never meant to rank, and often contain data you would rather not have cached anywhere.
- Tracking and duplicate parameters: UTM campaign tags and session IDs create endless URL variants of the same page. Blocking the parameter pattern is cheaper than relying on canonical tags to clean it up after the fact.
What to never accidentally block
The failures here are rarer than over-blocking low-value pages, but they are far more damaging because they can silently remove an entire site from search.
- The whole site: Disallow: / under User-agent: * blocks every crawler from everything. This is the single line that most often ends up live by accident, usually left over from a staging environment that got pushed to production without being changed back. Check this after every deploy.
- CSS and JavaScript files needed to render the page: Google renders pages before judging them, and it needs the same stylesheets and scripts a browser does to do that. Blocking /wp-includes/ or a shared /assets/ folder that also serves your CSS can make Google see a broken, unstyled page and judge it accordingly. If a folder serves both admin logic and front-end assets, split it or use Allow to carve out the assets.
- Your XML sitemap or robots.txt itself: robots.txt cannot block access to itself, but sitemaps sitting in a disallowed folder won't be readable by tools that respect the file.
- Canonical or paginated pages that still carry unique links or content: blocking page 2 onward of a paginated archive can strand products or posts that are only linked from those later pages.
Key takeaways
- ✓robots.txt controls crawling, not indexing. A blocked page can still surface in results if linked from elsewhere, usually with no snippet.
- ✓robots.txt is public and unenforced. Never rely on it to hide anything actually sensitive, put that behind authentication.
- ✓Use noindex when you want a page crawled but kept out of results. It requires crawling to be allowed, or Google never sees the tag.
- ✓Block admin panels, internal search, filtered/faceted URLs, and thank-you pages. Never block the whole site or the CSS/JS a page needs to render.
- ✓Check robots.txt after every deploy. A stray Disallow: / left over from staging is the most common and most costly accident.
Explore the data behind this guide
robots.txt & Meta Robots Tags, FAQ
Does robots.txt stop a page appearing in Google search results?+
Not reliably. robots.txt blocks crawling, not indexing. If another site links to a blocked URL, Google can still list it in results, typically as a bare link with no title or description, because it was never allowed to fetch the page. To reliably keep a page out of results, allow crawling and use a noindex meta tag instead.
Can I use robots.txt to hide sensitive pages or folders?+
No. robots.txt is a public file that any crawler, including malicious ones, can read at yourdomain.com/robots.txt, and well-behaved crawlers follow it voluntarily rather than being forced to. Anything genuinely sensitive needs authentication, not a Disallow line, which at best is ignored and at worst maps out your hidden folders for an attacker.
What's the difference between robots.txt and a noindex meta tag?+
robots.txt tells crawlers not to request a URL at all. noindex, placed in the page's HTML head or as an X-Robots-Tag HTTP header, tells a crawler that has already fetched the page not to include it in search results. Combining both on the same URL usually backfires, because a blocked page can't be recrawled to notice the noindex tag.
Should I block CSS and JavaScript files in robots.txt?+
No, and this is one of the most damaging mistakes people make. Google renders pages using their CSS and JavaScript before evaluating them, so blocking the assets a page needs to render can make Google see a broken or empty page and rank it accordingly.
What should a small business website typically block in robots.txt?+
Common candidates are admin login areas, internal search result pages, filtered or faceted navigation parameters on ecommerce sites, cart and checkout pages, and thank-you or confirmation pages. None of these need to compete for a place in search results, and blocking them keeps crawlers focused on pages that do.
Related guides
Sources & data note
This guide describes documented, widely-accepted practice as published by Google Search Central, cited above. The example robots.txt file and the categorisation of what a typical small business site should block are our own synthesis based on that documentation and common CMS conventions, not a figure lifted directly from a single source, and are not separately cited line by line. Guides are written from primary sources, Nepali government departments, operators, park authorities and standards bodies, and each guide lists the sources used for its own facts. Rules, fees and prices in Nepal change; treat figures as current at the review date shown on each guide and verify anything money- or visa-critical with the issuing authority before you rely on it.