Navigation | YW Digital Edge
SEO & AI Search

What Is robots.txt? A Simple Guide for Website Owners

By YW Digital Edge
robots.txt guide explaining user-agent, allow, disallow and sitemap directives

A robots.txt file is one of the smallest files on a website, but the rules inside it can affect how search engines access your content.

A single instruction can prevent crawlers from entering a particular section of a website or, if configured incorrectly, block them from crawling the entire site.

For website owners, the important part is not learning every robots.txt rule. It is understanding what the file controls, when it should be changed, and how to avoid blocking content that you want people to find through search.

What Is robots.txt?

A robots.txt file is a text file that provides crawling instructions to search engines and other web crawlers.

It sits at the root of your website.

For example:

https://example.com/robots.txt

When a compliant crawler visits a website, it can check this file to understand which URLs it is permitted to crawl.

A simple robots.txt file might look like this:

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://example.com/sitemap_index.xml

This may look technical, but the basic structure is relatively simple.

DirectiveWhat It Means
User-agentIdentifies which crawler the rules apply to
DisallowTells the crawler not to crawl a specified path
AllowExplicitly allows crawling of a specified path
SitemapProvides the location of the website’s XML sitemap
*Represents all crawlers when used as the user-agent

Google describes robots.txt primarily as a way to manage crawler access and crawling traffic to a website.

How Does robots.txt Work?

A robots.txt file contains groups of instructions.

Each group normally starts by identifying a crawler:

User-agent: Googlebot

Rules underneath that line tell the crawler which areas it can or cannot access.

For example:

User-agent: Googlebot
Disallow: /private/

This tells Googlebot not to crawl URLs under:

/private/

You can also create a rule that applies broadly to crawlers:

User-agent: *
Disallow: /private/

The * acts as a wildcard for user agents, so this group applies to crawlers that match it.

What Does Disallow Mean?

Disallow specifies a path that a crawler should not crawl.

For example:

Disallow: /wp-admin/

tells the relevant crawler not to crawl URLs within /wp-admin/.

One particularly important rule is:

User-agent: *
Disallow: /

The / represents the entire site.

This can therefore tell compliant crawlers not to crawl the website.

For a public business website that is supposed to appear in search, accidentally publishing this rule can create a serious crawling problem.

What Does Allow Mean?

Allow can be used to permit access to a specific path within a broader disallowed area.

A common WordPress example is:

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

The broader /wp-admin/ area is disallowed while admin-ajax.php is explicitly allowed.

Why is the Sitemap Listed?

You may also see something like:

Sitemap: https://example.com/sitemap_index.xml

This tells crawlers where the website’s XML sitemap is located.

The sitemap and robots.txt serve different purposes.

robots.txt provides crawling instructions.

XML sitemap provides information about URLs that you want search engines to discover.

It is therefore normal to see the sitemap URL included in robots.txt.

Where Can You Find Your robots.txt File?

The easiest way to check your website is to add:

/robots.txt

after your domain name.

For example:

https://example.com/robots.txt

If a robots.txt file is available, its contents should appear directly in your browser.

This is also a useful first check before making any changes. You may already have rules created by WordPress, an SEO plugin or your website setup.

Does Every Website Need a robots.txt File?

Not necessarily.

A small public website that wants crawlers to access everything may not need complicated robots.txt rules.

Google notes that a website may not need a robots.txt file if there are no URLs that need to be blocked from crawling.

For many WordPress websites, however, a robots.txt file or virtual robots.txt configuration is already present.

It may be used to:

  • control crawler access to particular directories;
  • point crawlers to the XML sitemap;
  • manage crawling of unnecessary URLs;
  • provide crawler-specific instructions.

The important point is that robots.txt should have a purpose. Adding more rules does not automatically improve SEO.

robots.txt Controls Crawling, Not Indexing

This is one of the most important things to understand about robots.txt.

Blocking a URL in robots.txt is not the same as telling Google not to index the URL.

A URL blocked from crawling can still potentially appear in search results if Google discovers that URL through other sources, such as links from other websites.

If you specifically want an accessible page excluded from Google’s index, a noindex directive can be used.

For example:

<meta name="robots" content="noindex">

There is an important catch: Google needs to crawl the page to see the noindex directive.

If the same page is blocked through robots.txt, Google may not be able to crawl it and discover the noindex instruction.

A useful way to remember the difference is:

ControlMain Purpose
robots.txtControls crawler access
noindexControls whether an accessible page should be indexed
XML sitemapHelps search engines discover important URLs

These tools work together, but they do different jobs.

What Should a Basic WordPress robots.txt Look Like?

There is no single robots.txt configuration that is correct for every WordPress website.

A simple setup may look like this:

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://example.com/sitemap_index.xml

Replace the example sitemap with your actual sitemap URL.

Before copying any template, check your existing file first.

An ecommerce store, membership website, multilingual site or website with custom functionality may require different rules.

How to Update robots.txt on Your Website

There are two common ways to manage robots.txt on a WordPress website.

You can edit a physical file through your website hosting or manage a virtual robots.txt file through an SEO plugin such as Rank Math.

Option 1: Update robots.txt Through Your Website Hosting

If your website uses a physical robots.txt file, it should be located in the root directory of the website.

You can normally access this through:

  • your hosting File Manager;
  • cPanel;
  • FTP;
  • SFTP.

Look for:

robots.txt

in the same general root area where your WordPress installation files are located.

Before editing it, first visit:

https://yourdomain.com/robots.txt

and save a copy of the existing rules.

This gives you a reference if you need to restore the previous version.

Then open the physical robots.txt file through your hosting environment, make the required changes and save the file.

Finally, visit:

https://yourdomain.com/robots.txt

again and confirm that your updated rules are being served.

Option 2: Edit robots.txt With SEO Plugin Rank Math

If your WordPress website uses an SEO plugin such as Rank Math, you can edit robots.txt from the WordPress dashboard without accessing your hosting files.

Go to:

WordPress Dashboard → Rank Math SEO → General Settings → Edit robots.txt

This section shows the robots.txt rules currently managed by Rank Math. Review the existing rules before making any changes, then select Save Changes when you are finished.

If the Edit robots.txt option is not available, switch Rank Math to Advanced Mode and check the General Settings again.

Physical robots.txt vs Rank Math

There is one important difference to understand.

Rank Math generates a virtual robots.txt file.

If your server already contains a physical robots.txt file, the physical file can prevent Rank Math’s virtual version from being used.

In that situation, manage the physical file directly or, where appropriate for your setup, remove it and use the virtual version.

Avoid maintaining two different versions without knowing which one your website is actually serving.

Common robots.txt Mistakes

A robots.txt file is small, but a small mistake can affect how crawlers access a large part of a website.

Accidentally Blocking the Entire Website

Be especially careful with:

User-agent: *
Disallow: /

This can prevent compliant crawlers from crawling the entire site.

A rule like this may be intentional on a development or staging website but is usually a problem if it remains after the public website launches.

Using robots.txt to Hide Private Information

Do not treat robots.txt as a security tool.

The file itself is publicly accessible, and crawler instructions do not provide authentication or access protection.

If information genuinely needs to remain private, use appropriate access controls such as authentication or password protection.

Confusing Disallow With noindex

This is another common mistake.

Disallow: /page/

controls crawling.

It does not provide the same instruction as:

<meta name="robots" content="noindex">

which controls indexing for crawlers that can access and process the page.

Replacing Existing Rules Without Checking Them

Avoid copying a robots.txt template from another website and immediately replacing your existing file.

Your current rules may exist for a reason.

Review what is already there, understand the changes you are making, and keep any rules that your website still needs.

Using the Wrong Sitemap URL

If your sitemap is included in robots.txt, make sure the URL actually works.

For example:

Sitemap: https://example.com/sitemap_index.xml

should lead to the real sitemap when opened in a browser.

How to Check Your robots.txt After Making Changes

Start by opening:

https://yourdomain.com/robots.txt

Confirm that the latest version appears.

Then check:

  • Is Disallow: / accidentally applied to crawlers that should access the site?
  • Are important public sections being blocked?
  • Is the sitemap URL correct?
  • Are the rules targeting the intended user agent?
  • Are old rules still present that you no longer need?

Whenever you make a significant robots.txt change, check the result carefully before moving on.


A robots.txt file gives crawlers instructions about which parts of your website they can access.

For most business websites, the important principles are straightforward:

Allow crawlers to reach the public content you want discovered, block crawling only where there is a reason to do so, and do not use robots.txt as a substitute for indexing or security controls.

Before changing the file, always check what is already there and confirm that the rules support how you want your website to be discovered.