{"id":687,"date":"2016-11-07T00:00:00","date_gmt":"2016-11-07T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/websitehow-to-block-search-engines-using-robotstxt\/"},"modified":"2025-04-13T08:25:26","modified_gmt":"2025-04-13T08:25:26","slug":"how-to-block-search-engines-using-robotstxt","status":"publish","type":"post","link":"\/tutorials\/how-to-block-search-engines-using-robotstxt\/","title":{"rendered":"Robots.TXT disallow: how does it block search engines"},"content":{"rendered":"<p>Are you looking for a way to control how search engine bots crawl your site? Or do you want to make some parts of your website private? You can do it by modifying the <strong>robots.txt<\/strong> file with the<strong> disallow<\/strong> command.<\/p><p>In this article, you will learn what<strong> robots.txt<\/strong> can do for your site. We&rsquo;ll also show you how to use it in order to block search engine crawlers.<\/p><figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Build-WordPress-Website-in-9%20Steps.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69276\" style=\"width:840px;height:auto\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-robots-txt\">What Is Robots.txt<\/h2><p><strong>Robots.txt <\/strong>is a plain text file used to communicate with web crawlers. The file is located in the root&nbsp;directory of a site.<\/p><p>It works by telling the search bots which parts of the site should and shouldn&rsquo;t be scanned. It&rsquo;s up to <strong>robots.txt <\/strong>whether the bots are allowed or disallowed to crawl a website.<\/p><p>In other words, you can configure the file to <a href=\"\/tutorials\/prevent-search-engines-from-indexing-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">prevent search engines from scanning and indexing pages<\/a> or files on your site.<\/p><h2 class=\"wp-block-heading\" id=\"h-why-should-i-block-a-search-engine\">Why Should I Block a Search Engine<\/h2><p>If you want to block crawlers from accessing your entire website, or if you have sensitive information on pages that you want to make private. Unfortunately, search engine bots can&rsquo;t automatically distinguish between public and private content. In this case, restricting access is necessary.<\/p><p>You can also restrict bots from crawling your entire site. Especially if your website is in maintenance mode or staging.<\/p><p>Another use of<strong> robots.txt<\/strong> is to prevent <a href=\"https:\/\/moz.com\/learn\/seo\/duplicate-content\" target=\"_blank\" rel=\"noreferrer noopener\">duplicate content<\/a> issues that occur when the same posts or pages appear on different URLs. Duplicates can negatively impact <a href=\"\/tutorials\/what-is-seo\/\" target=\"_blank\" rel=\"noreferrer noopener\">search engine optimization (SEO)<\/a>.<\/p><p>The solution is simple &ndash; identify duplicate content, and disallow bots from crawling it.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-robots-txt-to-disallow-search-engines\">How to Use Robots.txt to Disallow Search Engines<\/h2><p>If you want to check your site&rsquo;s <strong>robots.txt <\/strong>file, you can view it by adding <strong>robots.txt<\/strong> after your site&rsquo;s URL, for example, <strong>www.myname.com\/robots.txt<\/strong>. You can edit it through your web hosting control panel&rsquo;s file manager, or an <a href=\"\/tutorials\/ftp\/filezilla-ftp-configuration\/\" target=\"_blank\" rel=\"noreferrer noopener\">FTP client<\/a>.<\/p><p>Let&rsquo;s configure the <strong>robots.txt<\/strong> file via Hostinger&rsquo;s <strong>hPanel&rsquo;s<\/strong> file manager. First, you have to enter the <strong>File Manager<\/strong> in the<strong> Files<\/strong> section of the panel. Then, open the file from the<strong> public_html<\/strong> directory.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-public_html-robots.txt_.png\"><img decoding=\"async\" width=\"1024\" height=\"194\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-public_html-robots.txt_.png\/w=1024,h=1024,fit=scale-down\" alt=\"The public_html directory with the \" class=\"wp-image-80668\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-public_html-robots.txt_.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-public_html-robots.txt_.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-public_html-robots.txt_.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/hpanel-files-filemanager-public_html-robots.txt_.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div><p>If the file isn&rsquo;t there, you can create it manually. Just click the <strong>New File<\/strong> button at the top right corner of the file manager, name it <strong>robots.txt<\/strong> and place it in <strong>public_html<\/strong>.<\/p><p>Now you can start adding commands to the file. The two main ones you should know are:<\/p><ol class=\"wp-block-list\">\n<li><strong>User-agent<\/strong> &ndash; refers to the type of bot that will be restricted, such as <a href=\"https:\/\/developers.google.com\/search\/docs\/crawling-indexing\/googlebot\" target=\"_blank\" rel=\"noreferrer noopener\">Googlebot<\/a> or <a href=\"https:\/\/www.bing.com\/webmasters\/help\/which-crawlers-does-bing-use-8c184ec0\" target=\"_blank\" rel=\"noreferrer noopener\">Bingbot<\/a>.<\/li>\n\n\n\n<li><strong>Disallow <\/strong>&ndash; is where you want to restrict the bots.<\/li>\n<\/ol><p>Let&rsquo;s look at an example. If you want to prevent Google&rsquo;s bot from crawling on a specific folder of your site, you can put this command in the file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">User-agent: Googlebot&nbsp;\nDisallow: \/example-subfolder\/<\/pre><p>You can also block the  search bots from crawling on a specific web page. If you want to block Bingbot from a page, then you can set the command like this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">User-agent: Bingbot\n\nDisallow: \/example-subfolder\/blocked-page.html<\/pre><p>Now, what if you want the<strong> robots.txt<\/strong> file to disallow all search engine bots? You can do it by putting an<strong> asterisk (*)<\/strong> next to <strong>User-agent<\/strong>. And if you want to prevent them from accessing the entire site, just put a <strong>slash (\/)<\/strong> next to <strong>Disallow<\/strong>. Here&rsquo;s how it looks:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">User-agent: *\n\nDisallow: \/<\/pre><p>You can set up different configurations for different search engines by adding multiple commands to the file. Also, keep in mind that the changes take effect after you save the <strong>robots.txt<\/strong> file.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Now you&rsquo;ve learned how to modify the <strong>robots.txt<\/strong> file. This lets you manage search engine bot access to your website. Now you can rest easy knowing that only what you want to be found on search engine result pages will show up there.<\/p><p>\n\n\n        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn More About Website Optimization                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><a href=\"\/tutorials\/website-optimization\/\">What Is Website Optimization<\/a><br>\n<a href=\"\/tutorials\/what-is-a-sitemap\/\">What Is a Sitemap<\/a><br>\n<a href=\"\/tutorials\/submit-website-to-search-engines\/\">How to Submit Your Website to Search Engines<\/a><br>\n<a href=\"\/tutorials\/website-localization\/\">Website Localization Complete Guide<\/a><\/p>\n                    <\/div>\n        \n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you looking for a way to control how search engine bots crawl your site? Or do you want to [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/how-to-block-search-engines-using-robotstxt\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Block Search Engines Using robots.txt disallow Rule","rank_math_description":"You can disallow all search engine bots to crawl on your site using the robots.txt file. In this article, you will learn exactly how to do it!","rank_math_focus_keyword":"robots txt disallow all","footnotes":""},"categories":[22617,22619],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-digital-marketing","category-seo"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/como-criar-robots-txt-bloquear-mecanismos-busca","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/como-bloquear-los-motores-de-busqueda-utilizando-robotstxt","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/como-bloquear-los-motores-de-busqueda-utilizando-robotstxt","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/como-bloquear-los-motores-de-busqueda-utilizando-robotstxt","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-bloquear-los-motores-de-busqueda-utilizando-robotstxt","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-criar-robots-txt-bloquear-mecanismos-busca","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-block-search-engines-using-robotstxt","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=687"}],"version-history":[{"count":20,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/687\/revisions"}],"predecessor-version":[{"id":112206,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/687\/revisions\/112206"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}