Robots.txt is a plain text file located in a website’s root directory that tells search engine crawlers which addresses on the site they can access. The robots.txt file manages crawling, not indexing: to remove a page completely from Google results, the correct tool is noindex or password protection.

This guide bases its definition on Google Search Central documentation and then moves on to practical matters: the file’s syntax, how rules are matched, the difference between blocking and noindex, commonly used examples, editing in WordPress, testing with Search Console, and managing AI bots such as GPTBot, OAI-SearchBot, and Google-Extended, a topic frequently asked about recently.

What does the robots.txt file do?

This file is primarily used to manage crawler traffic and prevent crawling of unimportant or very similar sections of a website. Google’s introductory documentation on the subjectalso emphasizes that this file is not a mechanism for keeping web pages out of Google.

The answer to the question of what robots.txt is becomes complete by understanding what the file affects, and that effect varies by content type. For web pages, it is used to reduce crawling load or exclude sections that generate an infinite number of addresses, such as filters and search results pages. For images, videos, and audio files, it can prevent those files from appearing in Google search results. Resources such as stylesheets and scripts can also be blocked, but if proper page rendering depends on those resources, blocking them makes it harder for Google to understand the page.

The file is not a security tool either. The rules do not force a crawler to comply; Googlebot and other trustworthy crawlers follow them, while malicious bots may not. Furthermore, the file is public; writing the name of a folder that should remain private here means announcing it to everyone.

How do you write robots.txt? Basic syntax

The file consists of one or more rule groups; each group begins with a user-agent line and lists, line by line, the paths that crawler can or cannot access. The file must be plain text encoded in UTF-8, named robots.txt, and published in the root directory of the host to which it applies; for example, https://www.example.com/robots.txt. A copy placed in a subfolder is disregarded.

The fields supported by Google are as follows:

  • user-agent: which crawler the rule applies to. The asterisk (*) matches all crawlers, except Google’s AdsBot crawlers, which must be specified separately by name.
  • disallow: the path that should not be crawled; it begins with / and ends with / if it refers to a folder.
  • allow: allows a specific subpath inside a blocked folder to be crawled.
  • sitemap: the full address of the sitemap; it is optional and can be used more than once in the file.

Other fields, such as crawl-delay, are not supported by Google. Below is a simple file consisting of two groups: the first group blocks the administration panel folder for all crawlers, while the second line states the location of the sitemap.

User-agent: *
Disallow: /yonetim/

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

How are robots.txt rules matched?

A crawler selects the most specific user-agent group matching itself in the file and ignores the other groups; within the group, the most specific rule according to path length is applied. According to Google’s documentation explaining how it interprets the robots.txt specification , when equally specific allow and disallow rules conflict, the less restrictive allow rule is applied.

This rule has a practical consequence: when a separate group is written for Googlebot, Googlebot no longer reads the general group with the asterisk. If a restriction added to the general group should also cover Googlebot, the rule must also be written in the Googlebot group. Paths are case-sensitive; /Urun/ and /urun/ are different paths. In a path, the asterisk (*) represents any sequence of characters, and the dollar sign ($) represents the end of the address.

The limits relating to the file itself should also be understood. Google applies a size limit of 500 KiB to this file and ignores the portion exceeding that limit; it generally caches the file’s contents for up to 24 hours. If the file returns a 4xx error such as 404 (except 429), Google assumes there are no crawling restrictions; if it returns a server error (5xx), Google first stops crawling and then uses the last valid version for a while. In other words, a file returning a server error can cause more problems than a file that does not exist at all.

Page contents

Trustworthy web agency: handshaking client and team, trust shield illustration

Blocking is not removal from the index: the noindex difference

A page blocked by a crawling rule is not crawled by Google, but if it receives links from other websites, its address can still be indexed and appear in search results without a description. If the page should not appear in results at all, the tool to use is the noindex rule.

There is a common mistake here: adding noindex to a page while also blocking it with a crawling rule. According to Google’s documentation on blocking indexing with noindex , for noindex to work, the page must not be blocked by robots.txt and must be accessible to the crawler; otherwise, Googlebot can never see the tag. In addition, writing the noindex rule inside robots.txt is not supported by Google.

MethodWhat does it do?When is it used?
Robots.txt disallowBlocks crawling; the address may remain in results through linksSections creating crawling load, such as filters, internal search, and infinite calendars
noindex (meta tag or X-Robots-Tag)The page is removed from the index when it is crawledPages that can be crawled but should not appear in results, such as thank-you pages and thin tag archives
Password protectionCompletely blocks access to the contentTest environments, customer dashboards, confidential documents
Removing the page (404/410)The content no longer exists; it drops out of the index over timeContent permanently taken offline

Because meta tags cannot be used in non-HTML files such as PDFs and images, noindex is provided through the X-Robots-Tag response header sent by the server.

Commonly used robots.txt examples

For most corporate websites, the correct crawling file is short: one or two lines blocking the administration area and a sitemap declaration. The examples below are general patterns; because each website has a different path structure, they should be compared against the site’s own addresses before being copied exactly.

The simplest file allowing the entire website to be crawled is written with an empty disallow line; this is also the default behavior when the file does not exist:

User-agent: *
Disallow:

A wildcard can be used to exclude parameter-based filter addresses and internal search results from crawling. In this example, addresses containing ?siralama= and the /ara/ folder are blocked:

User-agent: *
Disallow: /*?siralama=
Disallow: /ara/

To block a particular crawler entirely, write a separate group using that crawler’s name. The “Disallow: /” line, which blocks the entire website for all crawlers, is only appropriate in test environments that have not gone live, and seriously affects the site’s search visibility if forgotten on the live website.

Let’s review your crawling rules together

When you share your domain name through WhatsApp, a free preliminary assessment helps clarify together whether the current rules accidentally block important pages, whether there are conflicts with noindex, and which preference would be appropriate for AI bots.

How do you edit robots.txt in WordPress?

If there is no physical robots.txt file in the root directory, WordPress generates a virtual robots.txt for visitors; by default, this file blocks the administration folder (/wp-admin/) and allows the admin-ajax.php file. The built-in sitemap introduced with WordPress 5.5 is also added to this virtual file.

There are three ways to edit it:

  1. The SEO plugin’s file editor: most popular SEO plugins allow you to edit the contents of the virtual file through the dashboard. This is generally the method with the least risk.
  2. Physical file: a real file is uploaded to the root directory through FTP or the hosting panel. If a physical file exists, the server displays it and WordPress’s virtual file is bypassed; this is a common reason why subsequent changes made through a plugin do not appear.
  3. Filtering through code: developers can change the contents of the virtual file from theme or plugin code using the robots_txt filter.

The search engine visibility checkbox under Settings > Reading is a separate matter. Since WordPress 5.3, selecting this checkbox does not write “Disallow: /” into the file; instead, it adds a robots meta tag containing noindex to pages. Selecting this checkbox in a test environment and forgetting to clear it when going live is one of the best-known reasons why newly launched websites do not appear in search. These configuration-related problems can quickly be identified through WordPress troubleshooting services.

Transparent pricing: calculator and budget planning illustration

How do you manage AI bots with robots.txt?

Crawlers belonging to AI companies also look at the rules in this file, and each can be managed separately using its own user-agent name. What matters is making the decision with an understanding of what each bot does, because some concern appearing in AI search results, while others concern model training.

Robots.txt nameWho owns it, and what is it for?If blocked
OAI-SearchBotOpenAI; for displaying websites in ChatGPT’s search featuresThe website is not shown in ChatGPT search answers, but may appear as a navigational link
GPTBotOpenAI; crawling carried out to train artificial intelligence modelsIndicates a request that the content not be used in model training
Google-ExtendedGoogle; a product token used in rules, rather than a separate crawlerContent is not used for training future Gemini models or for grounding in Gemini; it does not affect inclusion or ranking in Google Search

According to OpenAI’s crawlers and user agents page, the two settings work independently; a configuration allowing the search bot while blocking the training bot is possible. The same page states that it may take approximately one day for a rule change to be reflected in ChatGPT search results. ChatGPT-User, which visits a page following a user’s instruction in ChatGPT, does not perform automatic crawling, and crawling rules may not apply to these visits because they are user-initiated requests.

Google-Extended does not replace Googlebot. According to Google’s common crawlers documentation, this token controls whether content is used for training next-generation Gemini models and for grounding in Gemini applications; it does not affect inclusion in Google Search and is not used as a ranking signal. Blocking Google-Extended also does not mean removing the website from Google’s AI features within search; according to Google’s AI features documentation, these are part of Search; access is restricted through Googlebot rules, and the information displayed is limited through controls such as nosnippet, max-snippet, and noindex.

How do you make a decision about AI bots?

The decision depends on whether the website wants to appear as a source in AI answers and on its position regarding the use of content in model training; there is no single correct setting. For a business selling services that wants to be found, allowing search-oriented bots generally makes sense. A publisher whose primary product is original content may prefer to block bots used for training.

For example, a website that wants to appear in ChatGPT search but does not want its content used for OpenAI model training can add the following rules:

# Crawling for model training disabled
User-agent: GPTBot
Disallow: /

# Crawling for ChatGPT search enabled
User-agent: OAI-SearchBot
Disallow:

How these preferences are managed alongside search visibility should not be considered independently of the website’s overall crawling and indexing status. Reviewing crawling rules, the sitemap, noindex, and redirects together is part of technical SEO services for a website.

How do you test robots.txt?

The file is tested in two ways: opening site.com/robots.txt in a browser verifies that the file is actually live and displays the correct content, and then the robots.txt report in Google Search Console checks how Google reads the file. The report shows the files Google has found, when they were last crawled, and any warnings or errors encountered during parsing.

After an important rule change, for example when accidentally blocked pages are unblocked, a recrawl of the file can be requested through the report. To see whether a single page is blocked, use the URL Inspection tool; if the page is blocked by a crawling rule, the tool indicates this. The report is available for domain properties and URL-prefix properties that do not include a path.

Common mistakes in the robots.txt file

Most mistakes in this file originate from a single line, but their impact can extend across the entire website. The most frequently encountered mistakes are as follows:

  • Moving the “Disallow: /” line from the test environment to the live website.
  • Blocking pages intended for removal from the index through robots.txt; in this case, noindex is not seen and the address may remain in results.
  • Blocking CSS and JavaScript folders; Google cannot render the page correctly.
  • Blocking the folder containing product images; the images cannot be used in Google Images and shopping listings.
  • Writing a separate group for Googlebot without repeating the rules from the general group there.
  • Writing the names of folders that should remain confidential in the file.
  • Using a relative address in the sitemap line; the address must be complete and absolute.

When these checks are added to the launch checklist while setting up a new website, most mistakes never occur. A structure with crawling and indexing settings configured correctly from the outset is part of an SEO-friendly web design approach; on live websites, checking that these settings have not broken after updates can be one step in the WordPress maintenance routine.

Let’s clarify your crawling settings together

The crawling file, noindex, and sitemap are interconnected settings; a change in one can affect the others. Let’s determine together which sections of the website should be crawled, which should remain indexed, and which preference for AI bots aligns with the business’s goals.

Frequently asked questions

If there is no robots.txt file, crawlers assume they can crawl the entire website; this is not considered an error. What matters is that the server returns a proper 404 response when the file is absent and does not return a server error.

No; disallow blocks crawling and does not guarantee removal from the index. To remove a page from results, noindex should be used and the page must remain crawlable.

Google generally caches robots.txt content for up to 24 hours, so a change may not be reflected immediately. A recrawl can be requested through the robots.txt report in Search Console.

If there is no physical file in the root directory, WordPress generates a virtual robots.txt and displays it at site.com/robots.txt. This content can be changed through the SEO plugin’s editor or through a physical file uploaded to the root directory.

According to OpenAI’s documentation, GPTBot and OAI-SearchBot settings are independent of each other. When GPTBot is blocked and OAI-SearchBot is allowed, the website can continue to appear in ChatGPT search results.

No; Google states that Google-Extended does not affect a website’s inclusion in Google Search and is not used as a ranking signal. This token manages the use of content for training Gemini models and for grounding in Gemini.

Google does not support the crawl-delay field, so it has no effect on Googlebot. Some other search engines may interpret this field differently; if crawling load is a problem, other methods are considered on Google’s side.