TR

Home / Guides / What Is robots.txt? How to Create It and Common Mistakes

What Is robots.txt? How to Create It and Common Mistakes

Updated: October 13, 2026 · AracMerkezi

▶ Open robots.txt Generator

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

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:

Common mistakes

  1. Accidentally blocking everything: Disallow: / puts the entire site out of crawling. It is a common mistake when moving from a test server to live.
  2. Blocking CSS and JS files: Google may not be able to render the page correctly.
  3. Wrong location: The file must be in the root directory and named robots.txt (lowercase).
  4. Writing the sitemap as a relative path: The Sitemap: line must be a full URL.
  5. Case: Path matches are case-sensitive.
  6. 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

  1. Start with a plain file: allow all bots and add the sitemap line.
  2. If needed, add areas with no value, such as the admin panel, internal search results, and filter parameters, with Disallow.
  3. Upload the file to the root directory and verify it by opening it in a browser.
  4. Check the robots.txt report in Search Console.
  5. 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?

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

This article is for general information only and is not legal, financial or medical advice. We are not an official institution.