What Is robots.txt? How to Create It and Common Mistakes
Updated: October 13, 2026 · AracMerkezi
robots.txt is a plain text file placed in your site's root directory that tells search engine bots which sections they may crawl. Its address is always in the form https://yourdomain.com/robots.txt; it does not work in a subfolder.
The simplest robots.txt
User-agent: *
Allow: /
Sitemap: https://yourdomain.com/sitemap.xml
- User-agent: Specifies which bot the rule belongs to;
*means all bots. - Disallow: A path you don't want crawled.
- Allow: A permitted path; usually used for an exception within a Disallow rule.
- Sitemap: The full address of the sitemap.
Example: keeping a section out of crawling
User-agent: *
Disallow: /admin/
Disallow: /search?
Allow: /admin/help.html
Sitemap: https://yourdomain.com/sitemap.xml
The * wildcard and $ (end of line) are supported by Google and Bing: Disallow: /*.pdf$ blocks URLs ending in .pdf.
A very important warning: robots.txt does not block indexing
Disallow blocks only crawling. If a page receives links from other sites, Google can still index the URL without seeing its content. To remove a page from search results:
- Add
<meta name="robots" content="noindex">to the page or send anX-Robots-Tag: noindexheader. - Make sure this page is not blocked by robots.txt; if it is blocked, the bot cannot see the
noindextag. - The way to protect hidden content is a password or authorization, not robots.txt; robots.txt is public.
Common mistakes
- Accidentally blocking everything:
Disallow: /puts the entire site out of crawling. It is a common mistake when moving from a test server to live. - Blocking CSS and JS files: Google may not be able to render the page correctly.
- Wrong location: The file must be in the root directory and named
robots.txt(lowercase). - Writing the sitemap as a relative path: The
Sitemap:line must be a full URL. - Case: Path matches are case-sensitive.
- Expecting Crawl-delay to work: Google does not honor this directive.
How is the file created?
Write it in a text editor, save it as robots.txt, and upload it to the main directory of the site. To get started quickly with ready-made templates, you can use the robots.txt Generator tool; add your own paths and copy the file. For the sitemap line, the sitemap.xml Generator also helps.
Checking
After uploading, open the address in a browser and see the contents. The robots.txt report in Google Search Console shows how Google reads the file. For small sites, a plain file (allow everything + a Sitemap line) is often enough.
Step by step: robots.txt for a new site
- Start with a plain file: allow all bots and add the sitemap line.
- If needed, add areas with no value, such as the admin panel, internal search results, and filter parameters, with
Disallow. - Upload the file to the root directory and verify it by opening it in a browser.
- Check the robots.txt report in Search Console.
- After the site goes live, make sure no
Disallow: /rule remains.
User-agent-specific rules
You can give a separate rule to a particular bot:
User-agent: Googlebot
Disallow: /test/
If a bot finds a group written for its own name, it ignores the general (*) group; so when writing a specific group, you need to include all the necessary rules in that group too.
Which areas should you block, and which not?
- Can be blocked: Cart, checkout, login, internal search results, endless filter combinations.
- Should not be blocked: CSS and JavaScript files that affect how pages look, images, and pages you want indexed.
A small warning
Writing addresses that must stay hidden into robots.txt makes the list of those addresses public. Protect sensitive sections with a password.
Example scenario
If on a product site the internal search pages starting with /search? generate thousands of similar URLs, blocking them with Disallow: /search? directs the crawl budget to the real pages. However, if these URLs already contain noindex, it is more correct not to block them with robots.txt, because the bot must be able to see the noindex tag. When deciding, first determine your goal: do you want to reduce crawling, or remove pages from the index?
Limitations
Compliance with the rules is voluntary; well-intentioned bots comply, while malicious bots may not. Google processes only the first 500 KiB of the file.
Frequently asked questions
Does robots.txt remove a page from Google?
No; it only blocks crawling. To remove a page from the index, use the noindex meta tag or X-Robots-Tag.
Where does robots.txt go?
In the site's root directory, so that its address is https://yourdomain.com/robots.txt.
What does Disallow: / do?
It puts the entire site out of crawling; it shouldn't be left in by accident when going live.
Tools mentioned in this guide
More guides
- What Is sitemap.xml? How to Create a Sitemap and Submit It to Search Console – What is sitemap.xml and how is it created? URL limit, using lastmod, steps to submit to Search Console, and common sitemap mistakes.
- How to Calculate Percentages: Six Question Types, Formulas and Examples – Percentage math: percent of a number, what percent one is of another, increase and decrease, percentage points and reverse percentages, with examples.
- How to Calculate VAT: VAT-Inclusive and VAT-Exclusive Formulas and Examples – How do you separate VAT from a VAT-inclusive amount or add it to a VAT-exclusive one? Formulas, a mixed-rate invoice, rounding gaps and shortcuts.
- How to Calculate Loan Payments: Formula, Step-by-Step Example and Interest vs. Principal Split – The monthly loan payment formula, a step-by-step example, the interest-versus-principal split and how to work back to the loan amount you can afford.
- How to Calculate Age From a Date of Birth: Age in Years, Months and Days – Work out your exact age in years, months and days, step by step. Month-end and leap-day edge cases, total days lived and common mistakes.
This article is for general information only and is not legal, financial or medical advice. We are not an official institution.