WordPress / Web Development Tutorials
(Best WordPress Tutorials)

Silva Web Designs - Blog

What Exactly Is a robots.txt File? How Does It Operate?

Robots.txt File – All Questions Answered!

Are you brushing up on your SEO knowledge and wondering what all the fuss is about robots.txt files? Well, you have landed in the right place! In this article, we will break everything you need to know about robots.txt in 2021. Let’s get started!

What Is a robots.txt File?

Robots.txt is a text file that tells search engines such as Google what pages on your website you want to be indexed or crawled. When processing a robots.txt file, crawlers get one of the 3 instructions – partial access (scanning of individual elements of the site is available), full access (you can scan anything), or scanning prohibition (the robot cannot scan anything).

By default, websites instruct search engines to crawl and index all of their pages as they want to increase their traffic by appearing high in the search engines’ results like norgesautomater, which appears when you search for online casinos. However, sometimes website owners want to limit which pages are indexed to high pages with private information or to save bandwidth. But how does a robots.txt file work? Let’s dive right in.

How Does a robots.txt File Operate?

Search engines are always looking to improve their results and give users access to the most updated and best information. To do this, they use bots known as spiders or crawlers. These bots automatically open recently published web pages and then decide if the content should be indexed.

When these bots first open a website, they request the robots.txt file, and then once they access the file, they follow the instructions laid in the filing relating to indexing. If the bots do not receive instructions from the robots.txt file, they use their own indexing methods.

Example of robots.txt Usage

Example 1

Stop the entire website from being indexed by bots:

User-agent: *
Disallow: / 

This instruction is used if the entire site is being updated and content is being edited.

Example 2

Give permission to bots to index the entire website:

User-agent: *

It is not recommended to use this robots.txt code because many pages such as terms of use, privacy policy, or login pages do not need to be shown on Google. You can increase the speed of your website by selectively excluding certain pages from indexing.

Check out below how to control the exact content that gets indexed:

Example 1

Prevent a specified number of directories from indexation:

User-agent: *
Disallow: /cgi-bin/

Example 2

Prevent your website from being indexed by a specific bot:

User-agent: Bot1
Disallow: /

Sometimes certain bots may be overloading your site. To stop their requests from tanking your site’s performance, you can temporarily block them from indexing.

Example 3

Allow one crawler to index while preventing others:

User-agent: Opera 9
User-agent: *
Disallow: /

Use the above robots.txt functions to get your site quickly indexed on a particular search engine such as Google while blocking others.

Example 4

Prevent every file from being indexed except one.

User-agent: *
Allow: /docs/file.jpeg
Disallow: /docs/

By using the above robots.txt syntaxes, you can boost the performance of your website while controlling the indexing process and getting the right pages indexed on Google and other search engines. If you apply the examples above, your site will grow organically in no time, bringing you thousands of new visitors.

Robots.txt and SEO

You always need to ensure that your images are being indexed to get more visitors to the website. The robots.txt file will sometimes exclude images. This exclusion will prevent your images from showing in Google’s Image Search and will hurt your rankings and your website’s traffic. To ensure your images are being indexed, simply open your robots.txt file and remove the line that says:

Disallow: /images/

Let your robots.txt page know about your sitemap.xml file

Add the following line in your robots.txt content:

Sitemap: http://www.domain.com/sitemap.xml

Hotfixes and Workarounds

Including URL indexing to ‘noindex’

If you want to prevent a page from being indexed by a search engine, use “noindex”. However, if you want, you can place the following page header:

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

By using the above code, the links posted on the page will still be retrieved. This will allow the bot to move around the website and its linked content. If nofollow is added, the crawler will stop when it reaches this page and will not move further to the interlinked content:

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

We don’t recommend this action as it will affect your page’s ranking on Google.

Removed content

If you have removed content from your website permanently, then you should also get rid of these pages from your robots.txt. It is not good enough to just block the expired content. As an alternative, you should create 301 redirects that need to be applied either in the .htaccess file.

Bot overload

It is common for your site to be overwhelmed with bots that want to check your page constantly, even when you have made the smallest upload. If bots show up at your site too often, they cause your site’s performance to crash and page speeds to grind to a halt. While some people opt to complete block bots when this happens, there is actually a better alternative, slowing them down! To reduce bot activity but still allow them to crawl your site, use this syntax:

crawl-delay: 10

What this does is put a 10-second delay on search bots visiting your pages.

Robots.txt for WordPress

WordPress will automatically set up a robots.txt file after you hit publish on your first post. This robots.txt file is virtual and can not be found on the service. To access this virtual robots.txt file, you will need to open this link: http://www.yoursite.com/robots.txt

WordPress’ virtual robots.txt file allows Google’s bot by default and will block some of the most common spambots. You have the option of creating your own real robots.txt at any moment by using a text editor, then uploading it to the root directory of your server via FTP. Your real robots.txt file will override the virtual one.


The robots.txt file is stored in text format on the server. It gives commands to search crawlers which pages should be indexed and which ones should not. All robot.txt files are made in accordance with the standard syntax, so their instructions are clear to all crawlers. Robots.txt file has a great impact on your website’s rankings, so it is crucial that you follow the advice in our article and get your content indexed without slowing down the site and providing a bad user experience.

Thanks to our guide, you should have a great understanding of robots.txt rules and how they operate. If you want to take your website to the next level, then try our robot.txt file workarounds right now. We would love to hear your opinion on robots.txt. Please comment below on how you use robot.txt to enhance your website and if you have noticed any boost in rankings.

Posted by: Arthur

Arthur is a digital marketer with a background in web design. He believes every business should be at home with everything Google has to offer. This popular search engine gets used by millions of potential clients every day and presents an enormous opportunity for anyone to stay visible online.


It’s good to share

Join the discussion