How to add a robots.txt file in wordpress

Do you want to add a robots.txt file to your website? And you are still unaware of how to do it in simple steps, then you are reading the right article. We will discuss what is a robots.txt file, why is it important and the steps to add it to your website.

What is a Robots.txt file?

A robots.txt file also known as plain text is simply an ASCII file that guides the search engines where they are NOT allowed to go on the website, this is also known as the Standard for Robot Exclusion. 

When the crawler will visit your website, they will skip the files listed as robots.txt files. The robots.txt files are neither crawled nor indexed by search engine spiders.

The Robots.txt files are really important because it allows you to control how search engines see your website. If you don’t create a robot.txt file then all your pages will be shown on the SERP.

Why Robots.txt file is important?

1. Limits the use of Resources

A bot uses up some of your internet and server resources each time it crawls your website. These funds would be better used to attract actual people and visitors to your website. If your website has a lot of content then it will cost more and give the actual visitors a poor experience. 

However, in order to save resources, you can use the robots.txt file to limit access to unimportant images, scripts, etc.

2. Stop bots from navigating to private folders

It will restrict search engine spiders to index confidential documents on your website if you forbid bots from crawling any of them.

3. Put important pages first.

Instead of wasting time crawling every page of the website, we want the search engines to focus on the important pages. The Robots.txt file facilitates work by prioritizing useful files.

You can quickly decide which pages search engine bots should prioritize by banning worthless pages. Creating a robots.txt file helps you attract search engine spiders, and it significantly boosts the ranking of your page. Let us now learn how to add a Robots.txt file:

You Might Also Like,

How to Use link rel=canonical to Prevent and Fix Duplicates – [Guide]

Steps to Add a Robots Text File:

Step 1: On your PC, open Microsoft Word and make sure all files are saved as the name “robots.”  select “Plain” Text as your text editor and “.txt” as the file type extension.

Step 2: Add the following two lines of text to your file:

User- Agent: *


“User-agent”: it is another term for robots or search engine crawlers.

asterisk (*): it denotes that all search engine spiders must read this line.

“Disallow”: As you can see, the “Disallow” line does not contain any folders or files. All directories on your website will presumably be accessible, according to this. The default robots.txt file is shown here.How to add robots.txt file
Step 3: You can prevent spiders from visiting any part of your website by using a robots.txt file option. You can accomplish these by including the lines shown below in the robots.txt file:

User-agent: *

Disallow: /

Step 4: Your robots.txt file can look something like this if you want to prevent crawlers from accessing certain portions of your website also all robots are informed by the three tags shown below that they are not permitted access to the scripts and database directories or even their subdirectories.

User-agent: *

Disallow: / database/

Disallow: /scripts/Remember: Each disallow line can contain only one file, you can use as many Disallow lines as you want, depending on your need.

Step 5: Don’t forget to add a search engine-friendly XML sitemap file to robots.txt file. this will help the search engines easily find your sitemap and index your website. 

The syntax to add your XML sitemap is as follows:Update robots.txt file

Address for the sitemap:

Also Read,

How to Use Schema Markup to Boost your SEO Efforts? [Ultimate Guide]

Step 6: After everything has been finished, save your work and upload your robot.txt file to the root directory of your website.

If your domain is, for example, you would put the robots.txt file at:

That’s how you create a robots.txt file on your website. 

Summing it up:

A robots.txt file instructs search engine spiders as to which pages or files they may or may not access on your website. This is mostly intended to prevent your website from becoming overloaded with queries; it is not a method of keeping a website off of Google.

You are doing more than simply improving your own SEO when you correctly configure your robots.txt file. Additionally, you are assisting your guests.
So, it is crucial to add a robots.txt file. I hope after reading this article you are clear with the importance and the steps by which robots.txt file can easily be added to your website. 

FAQs (Frequently Asked Questions)

Q. How can I include a Googlebot on my WordPress site?

Configure Simple Googlebot You can access it by uploading the files to your server or using the plugin repository.

Q. Where can I find my robots.txt file in WordPress?

A text file called Robots. txt can be found in your root WordPress directory. By going to your in your browser, you can access it. It informs search engine bots about the pages on your website that should and shouldn’t be crawled.

Q. Do I need a robots.txt file for my website?

A website does not need a robots.txt file. If a bot visits your website without one, it will simply crawl and index your pages as it normally would. Only if you want more control over what is being crawled do you need a robot. txt file.

Q. What information goes in the robots.txt file?

One or more blocks of directives, each beginning with a user-agent line, make up a robots.txt file. The name of the particular spider it addresses is the “user-agent.” Using a wildcard for the user-agent, you may either have one block for all search engines or specific blocks for specific search engines.

By john

Leave a Reply

Your email address will not be published. Required fields are marked *