Using WordPress Robots.txt File For Better SEO

Home - WordPress SEO & Marketing - Using WordPress Robots.txt File For Better SEO

If you manage a WordPress site, you have heard of ‘robots.txt.’ Yet, you probably wonder what it is. Besides, you might have asked yourself, “Is it an important part of my site?” Well, we have got you covered. In this post, you will get a clear picture of what WordPress robot.txt is and how it manages and helps increase your Website’s security.

If you are a business owner using the WordPress website to interact with your clients, promoting it in search engines is crucial. Optimization of the search engine involves many important steps. One of them constructs a good file for WordPress Robots.txt.

What is WordPress Robots.Txt File?

Before getting into the details about WordPress Robots.txt, let us first define what a ‘robot’ means in this context. However, we will do so by taking the example of search engine crawlers. They ‘crawl’ about the internet and help search engines like Google index and rank pages. Check tips to getting Google to index your site. Besides, these crawlers are ‘bots’ or ‘robots’ visiting websites on the internet.

To make it clear, bots are a necessary thing for the internet. Nonetheless, that does not mean you should let them run around your site unregulated. The WordPress Robots.txt file gets referred to as the ‘Robots Exclusion Protocol.’ They got developed because site owners wanted to control their interaction with websites. The robots.txt file can get used to limit bots’ access to certain site areas or even block them completely.Even so, this regulation is subject to certain limitations. For instance, they cannot get forced to follow the commands of the robots.txt file. Also, malicious bots can ignore the file. Google and other prominent organizations ignore certain controls you add in robots.txt. A security solution is useful if you are going through lots of problems with bots. For example, Cloudflare or Sucuri can be quite useful.

How Does the WordPress Robots.txt File Help Your Website?

There are two basic benefits of a well-integrated WordPress Robots.txt file. First, Robots.txt Disallow Googlebot that waste your server resources. Hence, it increases the efficiency of your site. Second, it optimizes search engines’ crawl resources. It tells them which URLs on y our site they get allowed to index. What happens before a search engine crawls any page on a domain it has not come across before? The domains robots.txt file gets opened, and its commands get analyzed. Unlike the believe, robots.txt is not for regulating the indexing of pages in search engines.Is your main aim of stopping certain pages from inclusion in search engine results? If so, a better way of doing this is by using a no-index meta tag or another equally direct approach. The reason is that robots.txt does not fully command search engines not to index content. Instead, it only commands them not to crawl it. As a result, it means that even though Google will not crawl the specified areas within your site. Those pages will still get indexed whenever an external site links to them.

Creating and Editing Your WordPress Robots.txt File

Your site will already have a robots.txt file created for it by WordPress. The WordPress Robots.txt file is always at the root of your domain. So, if your domain is, it should get found at This is a virtual file. Thus, it cannot get edited. To be able to edit your robots.txt file, what you need to do is create a physical file on your server. It can then get tweaked according to your requirements.

WordPress Robot.txt

Creating And Editing A Robots.Txt With Yoast SEO

This is a very popular WordPress robots.txt Plugin. Besides, its interface allows you to create/edit the robots.txt file. Here are steps to follow:

  • First, you need to enable Yoast SEO’s advanced features. This can get done by going to SEO, tapping on Dashboard, and choosing Features from the menu that appears. Then, toggle on the Advanced settings pages and Enable it.
  • Once it gets activated, go to SEO and select Tools, then click on File Editor. Then get an option to create the robots.txt file.
  • Click the “Create robots.txt file” button. Hence, you will get allowed to use the same interface to edit the contents of your file.

We will discuss what types of commands to put in your WordPress Robots.txt guide later in this article.

How do I add robots txt to WordPress all in one SEO

When it comes to popularity, the All in One SEO Pack plugin is almost on par with Yoast SEO. This plugin’s interface can be used to create and edit the WordPress Robots.txt file. Just follow these simple steps:

  • Go to the plugin dashboard, select Feature Manager and Activate the Robots.txt feature.
  • Now, choose Robots.txt, and You’ll be able to manage your robots.txt file here.

Creating and Editing a Robots.txt File via FTP

Do you use an SEO plugin for ranking that offers robots.txt? Hence, there is no need to worry.

A WordPress Robots.txt file can still get created and edited by using SFTP. Follow these steps:

  • Make a blank file named “robots.txt” using any text editor and save it.
  • Upload this file to the root folder of your site while you are connected to your site via SFTP.
  • You can now use STFP to make changes and edit your robots.txt file. You can also upload new versions of the file if you wish.

Deciding What to Put in Your WordPress Robots.txt

Now that you have a physical robots.txt file, you can tweak and edit it as per your requirements. Let us look at what you can do by using this file. We have already talked about the importance of WordPress Robots.txt in controlling bots and your site. Now, we will discuss the two core commands required to do this.

  • The goal of the User-agent control is to target particular bots. This command will help you create a rule that applies to one search engine but not another. Bots use user agents to identify themselves.
  • The Disallow command enables you to keep robots from accessing specific site areas.

Furthermore, there is another command called Allow. The command comes in use when you disallow access to a folder and its sub-folders. Yet, you want to allow access to a specific folder out of these. Keep in mind that all the content on your site gets marked with “Allow” by default. Thus, when adding rules, you should first state the user agent to which the rule will apply. Then, state the regulations that will put it in place using the allow and disallow functions.

How to Test Your WordPress Robots.txt

You can check your WordPress Robots.txt file to see if your entire site is crawlable, if you have blocked specific URLs, or if you already have blocked or disallowed certain crawlers. You can do this in the Google search console. You have to go to your site and go to “Crawl.” Under it, select “robots.txt Tester” and enter any URL to check its accessibility.

Look out for the UTF-8 BOM

Your WordPress Robots.txt file may look completely okay but have a major issue. For example, you may find that the directives given are not being adhered to, and pages that are not supposed to be crawled are being crawled. The reason behind this almost always comes down to an invisible character called the UTF-8 BOM.

Here BOM signifies byte order mark, and it sometimes tends to be added to files by older text editors. If this character is present in your robots.txt file, Google might not be able to read it and complain about “Syntax not understood.” This significantly impacts SEO and can render your robots.txt file useless. While testing your robots.txt file, look for the UTF-8 BOM by checking whether Google does not understand any of your syntaxes.

Ensuring the Correct Use of the WordPress Robots.txt

Let us end this guide with a quick reminder. Although robots.txt blocks are crawling, it does not necessarily stop indexing. Even so, robots.txt helps you add guidelines. They control and outline the interaction of your site with search engines and bots. Nonetheless, it does not control explicitly whether or not your content gets indexed. Tweaking your site’s robots.txt file can be very helpful if you intend:

  • Fixing your site, which is having trouble with a specific bot.
  • To have better control over search engines and some content/plugins on your site. Nonetheless, if you do not meet the above, you need to change your site’s default virtual robots.txt file.

How do I optimize a robot’s txt file?

WordPressRobots.txt generally resides in the root folder of your site. You will have to link to your site using an FTP client or view it using the file manager of your cPanel. If you have no robots.txt file in your site’s root directory, then you can create one. All you have to do is build a new text file and save it to your computer as robots.txt. Then, upload it to the root folder on your site.


This article explains the WordPress Robots.txt file, a popular component to make search engine bots more visible to the site. There are many reasons to optimize your WordPress Robot.txt file in. The main purpose of optimizing your robots.txt file is to stop search engines from crawling non-publicly accessible pages. We suggest you follow the format above to build a WordPress Robots.txt file for your site. We hope that this ultimate guide will help you for better SEO.