{"id":18145,"date":"2020-12-26T17:00:20","date_gmt":"2020-12-26T16:00:20","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=18145"},"modified":"2021-01-05T13:31:28","modified_gmt":"2021-01-05T12:31:28","slug":"wordpress-robots-txt-file","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/wordpress-robots-txt-file\/","title":{"rendered":"What is the &#8220;robots.txt&#8221; File in WordPress and How to Use it"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]The art and science of getting your website to rank high in the results of various search engines are commonly referred to as SEO (Search Engine Optimization). And there are a lot of different aspects when it comes to SEO, perhaps too many to cover in a single article. This is why we will be focusing on just one right now\u2014the WordPress robots.txt file. In this article, we will dig deeper into what the robots.txt file is and how to use it. Among other things, we will discuss different ways of creating the file and cover the best practices regarding its directives.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">What is the \u201crobots.txt\u201d file<\/h2>\n<p>[\/vc_column_text][vc_column_text]Robots.txt is a text file located in your root WordPress directory. You can access it by opening the <strong>your-website.com\/robots.txt<\/strong> URL in your browser. It serves to let search engine bots know which pages on your website should be crawled and which shouldn\u2019t. Strictly speaking, a website doesn\u2019t need to have a robots.txt file. If you are in the process of creating your website, it is best to focus on creating quality content first. <strong>The search engine bots will crawl your website regardless of whether you have the robots.txt file or not.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, there are quite a few benefits of having a robots.txt file with proper directives once your WordPress website is finished. Apart from preventing crawlers from crawling unnecessary content, optimized robots.txt directives ensure that your crawl quota (maximum amount of times a crawler can crawl your website during a given time) doesn\u2019t go to waste.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Moreover, well-written WordPress robots.txt directives can reduce the negative effects of bad bots by disallowing them access. This, in turn, <strong>might improve your overall website load speed<\/strong>. But keep in mind that robots.txt directives mustn\u2019t be your only security. Bad bots often ignore these directives so using a <a href=\"https:\/\/qodeinteractive.com\/magazine\/wordpress-security-plugins\/\">good security plugin<\/a> is highly advised, particularly if your website is experiencing issues caused by bad bots.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Finally, it is a common misconception that the robots.txt file can prevent some of the pages on your website from being indexed. <strong>The robots.txt file can contain directives that prevent crawling, not indexing<\/strong>. And, even if a page isn\u2019t crawled, it can still be indexed through external links leading to it. If you want to <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-noindex-a-page-in-wordpress\/\">avoid indexing a specific page<\/a>, you should use the <em>noindex<\/em> meta tag instead of the directives in the robots.txt file.[\/vc_column_text][vc_empty_space height=&#8221;80px&#8221;][vc_widget_sidebar sidebar_id=&#8221;new-top-picks-banner&#8221;][vc_empty_space height=&#8221;81px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to use the \u201crobots.txt\u201d file<\/h2>\n<p>[\/vc_column_text][vc_column_text]Having clarified what a WordPress robots.txt file is and some of what it does, we can consider how it\u2019s used. In this section, we will cover how to create and edit a robots.txt file, some of the good practices regarding its content, and how to test it for errors.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">How to create the \u201crobots.txt\u201d file<\/h3>\n<p>[\/vc_column_text][vc_column_text]By default, WordPress will create a virtual robots.txt file for any website. Such a file could look something like this, for example:<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots.jpg\" class=\"attachment-full size-full\" alt=\"Robots\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]However, if you want to edit it, you would need to create a real robots.txt file. In this section, we will explain three ways you can do so. Two of those involve the use of WordPress plugins, while the third relies on the use of FTP.[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Yoast SEO<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]With over 5 million active installations, <a href=\"https:\/\/wordpress.org\/plugins\/wordpress-seo\/\" target=\"_blank\" rel=\"noopener\">Yoast SEO<\/a> is one of the most popular SEO plugins available. It has a lot of site optimization tools, including a feature that allows users to create and edit robots.txt files.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]After <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-install-a-wordpress-plugin\/\">installing the plugin<\/a>, <strong>click on the newly-created <em>SEO<\/em> section<\/strong>, followed by the <strong>click on the <em>Tools<\/em> subsection<\/strong>. Within the page that opens, <strong>click on the <em>File editor<\/em> link<\/strong> near the top.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-File-Editor.jpg\" class=\"attachment-full size-full\" alt=\"Yoast SEO File Editor\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-File-Editor.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-File-Editor-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-File-Editor-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-File-Editor-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]On the following page, locate the <em>robots.txt<\/em> section. From there, if you haven\u2019t already created it before, you should<strong> press the<em> Create robots.txt file<\/em> button<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Create-robots.txt-file.jpg\" class=\"attachment-full size-full\" alt=\"Yoast SEO Create robots.txt file\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Create-robots.txt-file.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Create-robots.txt-file-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Create-robots.txt-file-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Create-robots.txt-file-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]This will create the file and you will be able to see its content in a text area. Using that same text area, you will be able to edit the content of your new robots.txt file. <strong>When you\u2019re done editing the file, press the <em>Save changes to robots.txt<\/em> button below.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Save-changes-button.jpg\" class=\"attachment-full size-full\" alt=\"Yoast SEO Save changes button\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Save-changes-button.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Save-changes-button-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Save-changes-button-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Yoast-SEO-Save-changes-button-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>All in one SEO<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<a href=\"https:\/\/wordpress.org\/plugins\/all-in-one-seo-pack\/\" target=\"_blank\" rel=\"noopener\">All in one SEO<\/a> is another highly popular SEO plugin that comes with various free features, including ones that allow users to create and edit WordPress robots.txt files.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]After installing the plugin, <strong>click on the new<em> All in One SEO<\/em> section<\/strong> in your dashboard menu, followed by a <strong>click on the <em>Feature Manager<\/em> option<\/strong>. Within the <em>Feature Manager<\/em> page, <strong>locate the <em>Robots.txt<\/em> feature<\/strong> and then <strong>press the <em>Activate <\/em>button<\/strong> next to it.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Feature-Manager.jpg\" class=\"attachment-full size-full\" alt=\"All in One SEO Feature Manager\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Feature-Manager.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Feature-Manager-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Feature-Manager-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Feature-Manager-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]This will create the robots.txt file. Afterward,<strong> you will also see a success message stating that the options have been updated<\/strong>. And a new subsection called <em>Robots.txt<\/em> will appear.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Updated.jpg\" class=\"attachment-full size-full\" alt=\"All in One SEO Updated\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Updated.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Updated-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Updated-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Updated-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]<strong>By clicking on the<em> Robots.txt<\/em> option, you will get a view of the new section. There, you will be able to add new rules\/directives to the robots.txt file, as well as see how it looks currently.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Robots.txt.jpg\" class=\"attachment-full size-full\" alt=\"All in One SEO Robots.txt\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Robots.txt.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Robots.txt-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Robots.txt-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/All-in-One-SEO-Robots.txt-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Creating the \u201crobots.txt\u201d file via FTP<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Apart from using a WordPress plugin, you can simply create the robots.txt file manually. First, <strong>create an empty .txt type file on your computer<\/strong> and <strong>save it as <em>robots.txt<\/em><\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"605\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Save.jpg\" class=\"attachment-full size-full\" alt=\"Robots Save\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Save.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Save-300x187.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Save-768x480.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Save-620x387.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Then you need to upload it to your server using FTP. If you aren\u2019t familiar with FTP, you should learn more <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-use-ftp\/\">about the use of FTP<\/a> before proceeding.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]When you\u2019re ready, <strong>connect to your server using your FTP credentials<\/strong>. Then, in the right-hand section,<strong> navigate to your root WordPress directory<\/strong>, often called public_html. In the left-hand section of your FTP client (we\u2019re using <a href=\"https:\/\/filezilla-project.org\/\" target=\"_blank\" rel=\"noopener\">Filezilla<\/a>), <strong>locate the robots.txt file<\/strong> you previously created and saved on your computer. <strong>Right-click on it<\/strong> and<strong> select the <em>Upload <\/em>option<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"518\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Public.jpg\" class=\"attachment-full size-full\" alt=\"Robots Public\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Public.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Public-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Public-768x411.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-Public-620x331.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Within moments the file will be uploaded and you will be able to see it among the files in your root WordPress directory.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>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 <em>View\/Edit<\/em> option.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"639\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/FTP-Robots.jpg\" class=\"attachment-full size-full\" alt=\"FTP Robots\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/FTP-Robots.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/FTP-Robots-300x198.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/FTP-Robots-768x506.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/FTP-Robots-620x409.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;82px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Adding rules to the \u201crobots.txt\u201d file<\/h3>\n<p>[\/vc_column_text][vc_column_text]Now that you know how to create and edit the robots.txt file, we can talk more about the directives this file can contain. The two directives that are present in robots.txt most often are <strong>User-agent<\/strong> and <strong>Disallow<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>The User-agent directive specifies which bot the directives listed underneath the User-agent directive are applied.<\/strong> You can specify a single bot (e.g. User-agent: Bingbot) or<strong> make the directives apply to all bots by putting an asterisk<\/strong> (User-agent: *).[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>The Disallow directive tells the bot not to access a specific part of your website.<\/strong> And there is also <strong>the Allow directive that simply does the opposite<\/strong>. You don\u2019t need to use it as often as Disallow, because bots are given access to your website by default. The Allow directive is usually used in combination with the Disallow directive. More precisely, it serves to allow access to a file or subfolder belonging to a disallowed folder.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Additionally, there are two other directives: <strong>Crawl-delay<\/strong> and <strong>Sitemap<\/strong>. <strong>The Crawl-delay directive is used to prevent server overload due to excessive crawling requests.<\/strong> However, <strong>this directive should be used cautiously<\/strong> as it isn\u2019t supported by some crawlers (e.g. Googlebot) and it is interpreted in different ways by the crawlers that do support it (e.g. BingBot). <strong>The Sitemap directive serves to point the search engines to your XML sitemap file.<\/strong> The use of this directive is highly advised, as it can help you with submitting the <a href=\"https:\/\/qodeinteractive.com\/magazine\/wordpress-sitemap\/\">XML sitemap you create<\/a> to Google Search Console or Bing Webmaster Tools. But keep in mind that you should use an absolute URL to reference your sitemap (e.g. Sitemap: <a href=\"https:\/\/www.example.com\/sitemap_index.xml\" target=\"_blank\" rel=\"noopener\">https:\/\/www.example.com\/sitemap_index.xml<\/a>) when using this directive.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]In the following section, we will show you two example snippets, to illustrate the use of the robots.txt directives that we mentioned above. However, these are only examples; depending on your website, you might need a different subset of directives. With that being said, let us take a look at the snippets.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">This example snippet disallows access to the entire \/wp-admin\/ directory to all bots, except for the \/wp-admin\/admin-ajax.php file found within.<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]User-agent: *<br \/>\nDisallow: \/wp-admin\/<br \/>\nAllow: \/wp-admin\/admin-ajax.php<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\">This snippet allows access to the \/wp-content\/uploads\/ folder for all bots. At the same time, it denies access to the \/wp-content\/plugins\/, \/wp-admin\/ and \/refer\/ folder, as well as to the \/readme.html file for all bots. 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.<\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]User-Agent: *<br \/>\nAllow: \/wp-content\/uploads\/<br \/>\nDisallow: \/wp-content\/plugins\/<br \/>\nDisallow: \/wp-admin\/<br \/>\nDisallow: \/readme.html<br \/>\nDisallow: \/refer\/<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Sitemap: https:\/\/www.example.com\/sitemap_index.xml<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Testing the \u201crobots.txt\u201d file<\/h3>\n<p>[\/vc_column_text][vc_column_text]After you add the directives that fit your website\u2019s requirements, you should test your WordPress robots.txt file. By doing so, you are both verifying that there aren\u2019t any syntax errors in the file, and making sure that the appropriate areas of your website have been properly allowed or disallowed.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To test the robots.txt file of your website, <strong>navigate to an <a href=\"https:\/\/technicalseo.com\/tools\/robots-txt\/\" target=\"_blank\" rel=\"noopener\">SEO-testing website<\/a><\/strong>. Then<strong> insert any URL managed by your website<\/strong> (your homepage URL, for example),<strong> choose a user agent<\/strong> (Googlebot, for example), and <strong>press the <em>Test<\/em> button<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"969\" height=\"588\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-tool.jpg\" class=\"attachment-full size-full\" alt=\"Robots tool\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-tool.jpg 969w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-tool-300x182.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-tool-768x466.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/12\/Robots-tool-620x376.jpg 620w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]If the URL is crawlable, you will see a green result saying <em>Allowed<\/em>. Otherwise, it will say <em>Disallowed<\/em>. To confirm the proper crawl directives on your website you can repeat the same process for as many different URLs on your website as you wish.[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Final Thoughts<\/h2>\n<p>[\/vc_column_text][vc_column_text]The robots.txt file is a text file located in the root directory of every WordPress site. It contains directives for crawlers telling them which parts of your website they should or shouldn\u2019t crawl. While this file is virtual by default, knowing how to create it on your own can be very useful for your SEO efforts.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]That\u2019s 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\u2019ve mastered all this, you can consider how to sort out your site\u2019s other SEO aspects.<br \/>\n[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>WordPress robots.txt files are one of those backend things that are very useful but few people know about them, so take a peek and learn more.<\/p>\n","protected":false},"author":11229,"featured_media":18252,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[25,4,39,13],"class_list":["post-18145","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-resources","tag-seo","tag-tips","tag-tools","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/18145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/11229"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=18145"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/18145\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/18252"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=18145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=18145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=18145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}