Robots.txt: Guiding Web Crawlers Where You Want Them to Look
Author: Concetta Varia
Categories: Technology
Robots.txt: Guiding Web Crawlers Where You Want Them to Look
Have you ever heard of web spiders? Do you know that you can tell them to index only the internet pages you want to be indexed?
Guiding web crawlers and helping them navigate through your website is easy. You just need to know how to create a good Robots.txt file.
If you are not familiar with these topics, you have come to the right place. In this blog, we will discuss how Google and other search engines’ indexing process works, as well as the role of web spiders and the importance of setting up an effective Robots.txt file.
What are web crawlers?
A web crawler, spider, or bot is an internet program that search engines send to go through your website, analyze the data it contains, and index it. Why? So that it can appear on the search results page each time that a user enters a related query.
In other words, web spiders aim to sort the content of (almost) every webpage to create virtual inventories that immediately provide the needed information each time a search is made.
As previously mentioned, search engine spiders are also called web crawlers. Why is that? Because crawling is a technical term that refers to the task accomplished by these bots, namely visiting a website to obtain and index its data.
Guiding web crawlers and helping them organize the piles of information that are constantly uploaded on the Internet is crucial. To do so, website owners provide a title and a summary that the bots will read together with the internal text of the website’s pages. These elements facilitate the spider’s crawling process. Depending on the quality of the indexed content, search engines answer the query introduced by a user by generating a list of results where the most reliable sites occupy the first place.
If you want to learn more about web spiders and how they work, go check our blog “What Is Web Crawler Software and What Does It Do?”.
Guiding web crawlers: what is Robots.txt?
Sometimes, to protect the SEO and privacy of your website, you will have to prevent search engines from visiting and indexing some of its pages. This means guiding web crawlers with the proper tools and making them go right where you want them to look.
How do you do that? By creating a Robots.txt file.
Robots.txt instructs web spiders on which URL of your site they can access. In other words, this file allows you to have more control over the pages of your website that are being crawled.
Such a tool is extremely popular among the owners of internet sites as it comes with several advantages. Robots.txt can indeed help you avoid:
- Excessive requests from search engine bots
- Server overloads caused by crawl traffic
- The index of irrelevant or similar pages on your website
However, beware! The Robots.txt file doesn’t hide a webpage from Google or another search engine. Indeed, if you block an internet page with Robots.txt, its URL will still appear in the search results. The only thing that will change is that the search result won’t show a description, nor will it include images, PDFs, video and audio files, as well as other non-HTML material.
Furthermore, if your webpage is blocked with Robots.txt but is mentioned by other sites, Google will still manage to crawl its URL without accessing the page.
If you want to keep your page out of the search engine results, you should opt for a different technique. For example, you could try guiding web crawlers by password-protecting the page or including a noindex meta tag. How does this last solution work?
The procedure is pretty simple. You will need to locate the noindex meta tag in the HTML of your web page by typing a line of code that looks like this:
<meta name=”robots” content=”noindex”>
When web spiders will visit the page and see that it includes the noindex meta tag, they will hide it from the search results, even if other internet sites refer to it with external links.
Why is it important to block certain pages?
As previously mentioned, the Robots.txt file is extremely useful when it comes to guiding web crawlers and preventing them from indexing certain pages that you don’t want them to access.
But why is it so important to block some pages?
First of all, we’ve already introduced that, if your website contains a page that is the duplicate of another one, it is key that search engine bots don’t crawl it and show it in the search results. Why? Because the showcase of duplicate content would damage your SEO.
Second, your website may contain a specific page or category that you want to make available only to those users who take a specific action. For instance, you could include a web section that contains the link to download a free marketing course. However, you want to make this page accessible only to those who have subscribed to your newsletter. Therefore, it is obvious that you will want to prevent Google from showing this page on the search results, otherwise, any user would have unlimited access to it.
Third, your webpage might contain some private files that you don’t want to be diffused. Once again, a good option is to block such elements using Robots.txt.
In all these cases, your Robots.txt file will have to contain a specific command that makes guiding web crawlers possible, allowing you to direct them only where you want them to go. Thanks to this command, the bots won’t access the page you don’t want to be accessed, keeping users from visiting it.
If you are wondering how to create a good Robots.txt file, just keep on reading. You will find all the answers in the next paragraph.
Guiding web crawlers: how do you set up a Robot.txt file?
Almost any text editor such as Notepad, TextEdit, vi, and more will allow you to create a Robots.txt file. On the other hand, word processors are not recommended because they often save documents in a proprietary format. This could cause some changes to the Robots.txt file, like the addition of special characters. Such modifications would lead to general malfunctions and prevent you from guiding web crawlers effectively.
So, while setting up your Robots.txt file, make sure that you follow each one of these steps:
- Name the file “robots.txt”
- Create only one robots.txt file for your website
- Place the robots.txt file at the root domain of your website. For instance, you can control the indexing process on every URL below https://ginbits.com/ by locating the robots.txt file at https://ginbits.com/robots.txt.
To enable web crawlers to read your Robots.txt file, you will also need to encode several lines of directives. These directives form different blocks and they all begin with a user-agent command followed by the rules referring to the user-agent.
Your Robots.txt file can include multiple directives. Let’s examine three of the most important ones: the user-agent, the disallow, and the allow options.
User-Agent
When it comes to guiding web crawlers, the user-agent command allows you to select and target only certain bots. For instance, you can use the user-agent directive to aim at Yahoo or Google spiders. You should always keep in mind that this command is case-sensitive. It is therefore crucial that you always check your majuscules and minuscules.
Here are some of the most common user-agent options:
User-agent: Googlebot (Google)
User-agent: Googlebot-Image
User-agent: Bingbot (Bing)
User-agent: slurp (Yahoo)
If you want all search engine bots to follow a specific directive, you can use an asterisk (*):
User-agent: *
This particular line of directives is called the wildcard user-agent and will allow you to apply a rule to every spider there is on the Internet. Guiding web crawlers has never been easier.
Disallow
The disallow command will prevent web bots from visiting and indexing certain pages of your website.
You can use this directive to obstruct the access of search engine spiders to a specific folder, like a portfolio, or a specific file, such as a PDF or a PowerPoint.
So, for example, when you want to block a PDF, you can use the following lines of directives:
User-agent: *
Disallow: *.pdf$
The $ symbol indicates to the search engine that .pdf is the end of the URL.
If you want to block access to the whole website, you can use the wildcard user-agent:
User-agent: *
Allow
As it is easy to guess, the allow command overrules the disallow one. You can use it to indicate that you do want web spiders to index certain pages or sections.
In the following example, we are guiding web crawlers by telling them not to access the portfolio directory. However, we also tell them that we do want one specific item of the portfolio to be indexed:
User-agent: Googlebot
Disallow: /portfolio
Allow: /portfolio/crawlitem1portfolio
Conclusion
A Robots.txt file is an essential means when it comes to guiding web crawlers and telling them what pages they can access and what pages they cannot access.
It is important to underline that, while Googlebots and other reputable web spiders strictly follow the commands of a Robots.txt file, not all search engine bots support Robots.txt directives. Moreover, each crawler might decode these directives differently, depending on the syntax used while creating your Robots.txt file.
If you want to learn more about this topic, visit “Introduction to Robots.txt”.
Tags: guiding web crawlers, Robots.txt, web crawler, web crawlers
Latest Posts