A user agent is a computer program representing a person, for example, a browser in a Web context.
Besides a browser, a user agent could be a bot scraping webpages, a download manager, or another app accessing the Web. Along with each request they make to the server, browsers include a self-identifying User-Agent HTTP header called a user agent (UA) string. This string often identifies the browser, its version number, and its host operating system.
Spam bots, download managers, and some browsers often send a fake UA string to announce themselves as a different client. This is known as user agent spoofing.
A typical user agent string looks like this: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0".
If you don’t know how to login to your server via FTP, contact your web hosting company to ask for instructions. Some plugins, like Yoast SEO, also allow you to edit the robots.txt file from within your WordPress dashboard.
If you want to instruct all robots to stay away from your site, then this is the code you should put in your robots.txt to disallow all: In effect, this will tell all robots and web crawlers that they are not allowed to access or crawl your site.
Important: Disallowing all robots on a live website can lead to your site being removed from search engines and can result in a loss of traffic and revenue. You exclude the files and folders that you don’t want to be accessed, everything else is considered to be allowed.
You simply put a separate line for each file or folder that you want to disallow. The reason for this setting is that Google Search Console used to report an error if it wasn’t able to crawl the admin-ajax.php file.
This sitemap should contain a list of all the pages on your site, so it makes it easier for the web crawlers to find them all. If you want to block your entire site or specific pages from being shown in search engines like Google, then robots.txt is not the best way to do it.
Search engines can still index files that are blocked by robots, they just won’t show some useful metadata. On WordPress, if you go to Settings Reading and check “Discourage search engines from indexing this site” then a no index tag will be added to all your pages.
In some cases, you may want to block your entire site from being accessed, both by bots and people. Keep in mind that robots can ignore your robots.txt file, especially abusive bots like those run by hackers looking for security vulnerabilities.
Also, if you are trying to hide a folder from your website, then just putting it in the robots.txt file may not be a smart approach. If you want to make sure that your robots.txt file is working, you can use Google Search Console to test it.
Using it can be useful to block certain areas of your website, or to prevent certain bots from crawling your site. If you are going to edit your robots.txt file, then be careful because a small mistake can have disastrous consequences.
For example, if you misplace a single forward slash then it can block all robots and literally remove all of your search traffic until it gets fixed. I have worked with a big site before that once accidentally put a Disallow : /” into their live robots.txt file.
It serves to let search engine bots know which pages on your website should be crawled and which shouldn’t. The search engine bots will crawl your website regardless of whether you have the robots.txt file or not.
However, there are quite a few benefits of having a robots.txt file with proper directives once your WordPress website is finished. Moreover, well-written WordPress robots.txt directives can reduce the negative effects of bad bots by disallowing them access.
Bad bots often ignore these directives so using a good security plugin is highly advised, particularly if your website is experiencing issues caused by bad bots. Finally, it is a common misconception that the robots.txt file can prevent some pages on your website from being indexed.
And, even if a page isn’t crawled, it can still be indexed through external links leading to it. If you want to avoid indexing a specific page, you should use the no index meta tag instead of the directives in the robots.txt file.
In this section, we will cover how to create and edit a robots.txt file, some good practices regarding its content, and how to test it for errors. It has a lot of site optimization tools, including a feature that allows users to create and edit robots.txt files.
Within the page that opens, click on the File editor link near the top. Afterward, you will also see a success message stating that the options have been updated.
Then, in the right-hand section, navigate to your root WordPress directory, often called public_HTML. In the left-hand section of your FTP client (we’re using FileZilla), locate the robots.txt file you previously created and saved on your computer.
If you wish to edit the uploaded robots.txt file afterward, find it in the root WordPress directory, right-click on it and select the View/Edit option. The Disallow directive tells the bot not to access a specific part of your website.
You don’t need to use it as often as Disallow, because bots are given access to your website by default. More precisely, it serves to allow access to a file or subfolder belonging to a disallowed folder.
The Crawl-delay directive is used to prevent server overload due to excessive crawling requests. The use of this directive is highly advised, as it can help you with submitting the XML sitemap you create to Google Search Console or Bing Webmaster Tools.
In the following section, we will show you two example snippets, to illustrate the use of the robots.txt directives that we mentioned above. This example snippet disallows access to the entire /admin/ directory to all bots, except for the /admin/admin-ajax.php file found within.
The example below shows the proper way of writing multiple directives; whether they are of the same or different type, one per row is a must. Additionally, this snippet example lets you reference your sitemap file by stating its absolute URL.
If you opt to use it, make sure to replace the www.example.com part with your actual website URL. After you add the directives that fit your website’s requirements, you should test your WordPress robots.txt file.
By doing so, you are both verifying that there aren’t any syntax errors in the file, and making sure that the appropriate areas of your website have been properly allowed or disallowed. It contains directives for crawlers telling them which parts of your website they should or shouldn’t crawl.
While this file is virtual by default, knowing how to create it on your own can be very useful for your SEO efforts. That’s why we covered various ways of making a physical version of the file and shared instructions on how to edit it.
Moreover, we touched on the main directives a WordPress robots.txt file should contain and how to test that you set them properly. Now that you’ve mastered all this, you can consider how to sort out your site’s other SEO aspects.
Disallow, in this case, tells search bots: “Hey, you are not permitted to crawl the admin folder”. Considering the sheer amount of work this is, Google relies on its search bots to get the job done, quickly.
Next, the bot proceeds to crawl and index not just the website’s pages but also its content, including the JS and CSS folder. You sure don’t want that to happen, and the only way to stop them is by instructing them not to in the robots.txt file.
For instance, you wouldn’t want users to access the theme and admin folder, plugin files, and categories page of your website. Also, an optimized robots.txt file helps conserve what is known as crawl quota.
That way, your website’s load speed would improve greatly. To view it, open your website in a browser, then append “/ robots.txt at the end.
The default WordPress robots.txt file is virtual, and so can’t be accessed nor edited. Yoast SEO plugin can create a robot.txt file for WordPress on the fly.
Next, click on the File editor link in the Coast dashboard. This will take you to an editor where you can add and edit rules to your WordPress’ robots.txt file.
For a start, add the following rules to the file you just created. Basically, there are just two instructions you can give to search bots: Allow and Disallow.
Allow grants them access to a folder, and Disallow does the opposite. The asterisk (*) tells search bots, “hey this rule is applicable to all of you”.
In this instance, we are denying search bots access to the plugins' folder. Once in Google Search Console, scroll down and click Go to the old version.
In the text editor, paste the rules you had added to the robots.txt file, finally, click Test. Search bots can be unruly at times, and the only way to checkmate their activities on your website is to use robots.txt.
You can use it to prevent search engines from crawling specific parts of your website and to give search engines helpful tips on how they can best crawl your website. The robots.txt file is only valid for the full domain it resides on, including the protocol (HTTP or HTTPS).
A robots.txt file tells search engines what your website’s rules of engagement are. In case of confusion directives, Google errs on the safe sides and assumes sections should be restricted rather than unrestricted.
If there're no robots.txt file present or if there are no applicable directives, search engines will crawl the entire website. While directives in the robots.txt file are a strong signal to search engines, it’s important to remember the robots.txt file is a set of optional directives to search engines rather than a mandate.
The robots.txt plays an essential role from a SEO point of view. Using the robots.txt file you can prevent search engines from accessing certain parts of your website, prevent duplicate content and give search engines helpful tips on how they can crawl your website more efficiently.
Robots.txt is often over used to reduce duplicate content, thereby killing internal linking so be really careful with it. My advice is to only ever use it for files or pages that search engines should never see, or can significantly impact crawling by being allowed into.
The mass majority of issues I see with robots.txt files fall into three buckets: Someone, such as a developer, has made a change out of the blue (often when pushing new code) and has inadvertently altered the robots.txt without your knowledge.
You’re running an e-commerce website and visitors can use a filter to quickly search through your products. This works great for users, but confuses search engines because it creates duplicate content.
Therefor, you should set up Disallow rules so search engines don’t access these filtered product pages. Preventing duplicate content can also be done using the canonical URL or the meta robots tag, however these don’t address letting search engines only crawl pages that matter.
Using a canonical URL or meta robots tag will not prevent search engines from crawling these pages. An incorrectly set up robots.txt file may be holding back your SEO performance.
It’s a very simple tool, but a robots.txt file can cause a lot of problems if it’s not configured correctly, particularly for larger websites. For larger websites, ensuring Google crawl efficiently is very important and a well-structured robots.txt file is an essential tool in that process.
In this example all search engines are told not to access the /admin/ directory. In the example above all search engines are not allowed to access the /media/ directory, except for the file /media/terms-and-conditions.pdf.
Referencing the XML sitemap in the robots.txt file is one of the best practices we advise you to always do, even though you may have already submitted your XML sitemap in Google Search Console or Bing Webmaster Tools. Please note that it’s possible to reference multiple XML sitemaps in a robots.txt file.
If search engines are able to overload a server, adding Crawl-delay to your robots.txt file is only a temporary fix. Example robots.txt with specified crawl-delay for Binge way search engines handle the Crawl-delay differs.
Choose the website you want to define the crawl rate for. By default, the crawl rate is set to “Let Google optimize for my site (recommended)”.
Bing, Yahoo and Yandex all support the Crawl-delay directive to throttle crawling of a website. Baidu does not support the crawl-delay directive, however it’s possible to register a Baidu Webmaster Tools account in which you can control the crawl frequency, similar to Google Search Console.
There’s absolutely no harm in having one, and it’s a great place to hand search engines directives on how they can best crawl your website. Plan carefully what needs to be indexed by search engines and be mindful that content that’s been made inaccessible through robots.txt may still be found by search engine crawlers if it’s linked to from other areas of the website.
It’s important to note that search engines handle robots.txt files differently. In the example above all search engines, including Google and Bing are not allowed to access the /about/ directory, except for the sub-directory /about/company/.
In the example above, all search engines except for Google and Bing, aren’t allowed access to /about/ directory. Having multiple groups of directives for one search engine confuses them.
The example above doesn’t allow search engines access to: In the example above all search engines except for Google are not allowed to access /secret/, /test/ and /not-launched-yet/.
The unofficial no index directive never worked in Bing, as confirmed by Frederic Debut in this tweet : While Google states they ignore the optional Unicode byte order mark at the beginning of the robots.txt file, we recommend preventing the “UTF-8 BOM” because we’ve seen it cause issues with the interpretation of the robots.txt file by search engines.
That includes Google robots which are searching for instance for news (googlebot-news) and images (googlebot-images). You don’t want to have your internal search result pages crawled.
You don’t want to have your tag and author pages crawled. Please note that these robots.txt file will work in most cases, but you should always adjust it and test it to make sure it applies to your exact situation.
The robots.txt file below is specifically optimized for Magento, and will make internal search results, login pages, session identifiers and filtered result sets that contain price, color, material and size criteria inaccessible to crawlers. Please note that these robots.txt file will work for most Magento stores, but you should always adjust it and test it to make sure it applies to your exact situation.
In order for them to stay out Google’s result pages you need to remove the URLs every 180 days. Do not use robots.txt in an attempt to prevent content from being indexed by search engines, as this will inevitably fail.
Google has indicated that a robots.txt file is generally cached for up to 24 hours. It’s important to take this into consideration when you make changes in your robots.txt file.
It’s unclear how other search engines deal with caching of robots.txt, but in general it’s best to avoid caching your robots.txt file to avoid search engines taking longer than necessary to be able to pick up on changes. It’s unclear whether other search engines have a maximum file size for robots.txt files.
No crawlers, including Google, are allowed access to your site. When you set a robots.txt to “Allow all”, you tell every crawler they can access every URL on the site.
For larger websites the robots.txt is essential to give search engines very clear instructions on what content not to access. All the search engines like Google, Bing and DuckDuckGo treat subdomains as an individual entity.
Writing Robots.txt for root domain or any subdomain won’t solve your problem. You will have to write separate Robots.txt files to disallow a domain, subdomain, a directory, or wildcards from your site.
If you don’t upload Robots.txt, SE's treat it allowed by default. We recommend you to block all those directories of your website which you don’t want to get crawled and scrapped by web bots.
Clean-param Indicates to the robot that the page URL contains parameters (like UTM tags) that should be ignored when indexing it. Robots from other search engines and services may interpret the directives differently.
The use of the Cyrillic alphabet is not allowed in the robots.txt file and server HTTP headers. Create a file named robots.txt in a text editor and fill it in.
The “Server responds with redirect to / robots.txt request” error occurs on the “Site diagnostics” page in Yandex. Webmaster. For the robots.txt file to be taken into account by the robot, it must be located in the root directory of the site and respond with HTTP 200 code. The indexing robot doesn't support the use of files hosted on other sites.
In short, a Robots.txt file controls how search engines access your website. Robots are applications that crawl through websites, documenting (i.e. “indexing”) the information they cover.
If you want to block access to pages or a section of your website, state the URL path here. It may seem counterintuitive to “block” pages from search engines.
Google has stated numerous times that it’s important to keep your website “pruned” from low quality pages. However, keep in mind that people can still visit and link to these pages, so if the information is the type you don’t want others to see, you’ll need to use password protection to keep it private.
Going forward, you can continue using robot.txt to inform search engines how they are to crawl your site. This WordPress SEO tutorial covers how to stop Google etc… from indexing pages under /admin/ via a robots.txt file.
That being said it does make sense to block search engines from indexing everything under /admin/ and the easiest way to achieve this is via your sites robots.txt file. I’m afraid that means using an FTP program like FileZilla to upload a modified robots.txt file to your server.
This isn’t ideal for security reasons: it’s disappointing the WordPress development team haven’t added ‘blank’ index.php files (index.php file with this one line of code
View source of this page and you won’t find any links to files under /includes/. The W3 Total Cache Plugin (with the right settings) combines the CS and JS files (for performance SEO reasons) and serves them from another folder.
This domain can safely disallow the /includes/ folder as long as the W3 Total Cache plugin is active. Search through the HTML code for instances of /includes/, if you find some (most likely JS files) don’t use the Disallow : /includes/” rule, Google doesn’t like it: you might get notifications via Google Webmaster Tools about blocking JS/CSS files.
Interests: wildlife, walking, environmental issues, politics, economics, journalism, consumer rights. The instructions from robots.txt help guide the crawlers to what is and what isn’t available to be crawled.
Without it, Google will report incorrect stats about a site, likely saying that they’re not mobile-friendly, and we don’t want that! This line blocks bots from accessing anything on that site which has a question mark in the URL, such as search and filtering pages (e.g. ?search=”my-search-parameter”, or /?filter=ascending).
For example, this would be used when you want to exclude all URLs that contain a dynamic parameter like Session ID to ensure the bots don’t crawl duplicate pages. By default, this is “0” which means bots can crawl as often as they’d like, sometimes tens of times per second.
This is where the benefit of a robots.txt file comes into play, since you can prevent bots from crawling unnecessary pages and reaching their crawl quotas on plugin or theme files, or simply pages you no longer want found online.