{"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":"2026-11-18T15:47:26","modified_gmt":"2026-11-18T15:47: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":"\n<p class=\"wp-block-paragraph\">You can block search engine crawlers from accessing specific pages, directories, or your entire website using the <code>Disallow<\/code> directive in a robots.txt file. This helps control which parts of your website search engines can crawl, reducing unnecessary requests to areas such as internal search results or filtered pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, <strong>blocking crawling doesn&#8217;t guarantee that a page won&#8217;t appear in search results<\/strong>. Search engines may still index a URL discovered through external links, even if robots.txt prevents them from accessing its content.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this tutorial, you&#8217;ll learn how robots.txt works, when to use Disallow rules, and how to configure them for specific search engines or all crawlers. We&#8217;ll also cover how to verify your settings and avoid accidentally blocking important pages.<\/p>\n\n\n\n\n\n\n<h2 id=\"h-what-does-robots-txt-block\" class=\"wp-block-heading h-t-title-2\">What does robots.txt block?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A robots.txt file tells search engine crawlers which URLs they should or shouldn&#8217;t access on your website. It&#8217;s a plain text file stored in your site&#8217;s root directory, typically accessible at <code>https:\/\/example.com\/robots.txt<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>Disallow<\/code> directive instructs compliant crawlers not to visit specified URLs. However, it doesn&#8217;t password-protect content or guarantee that blocked URLs will disappear from search results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, Google may still index a blocked URL if it discovers that address through links on other websites, even without crawling its content.<\/p>\n\n\n\n<h2 id=\"h-when-should-you-use-robots-txt\" class=\"wp-block-heading h-t-title-2\">When should you use robots.txt?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use robots.txt when you want to&nbsp;<a data-click-id=\"hgr-post-content-link-block-crawlers-from-accessing-your-entire-website\" href=\"\/tutorials\/prevent-search-engines-from-indexing-wordpress\/\">block crawlers from accessing your entire website<\/a>,&nbsp;reduce unnecessary crawling, or prevent compliant search engine bots from accessing specific areas of your website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, the correct approach depends on what you&#8217;re trying to achieve.<\/p>\n\n\n\n<figure tabindex=\"0\" class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>Your goal<\/th><th>Recommended method<\/th><\/tr><tr><td>Reduce crawling of unnecessary URLs<\/td><td>robots.txt Disallow<\/td><\/tr><tr><td>Prevent a page from appearing in Google Search<\/td><td><code>noindex<\/code> meta tag or HTTP header<\/td><\/tr><tr><td>Protect private or sensitive content<\/td><td>Password protection or access restrictions<\/td><\/tr><tr><td>Consolidate duplicate pages<\/td><td>Canonical tags or redirects<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if you want to exclude a page from Google Search, use <code>noindex<\/code> while keeping the page accessible to crawlers. Blocking that page in robots.txt would prevent Google from reading its noindex directive.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Similarly, don&#8217;t use robots.txt to protect staging websites containing sensitive information. The file is publicly accessible, and crawlers aren&#8217;t required to follow its instructions.<\/p>\n\n\n\n<h2 id=\"h-how-to-use-robots-txt-to-disallow-search-engines\" class=\"wp-block-heading h-t-title-2\">How to block search engine crawling using robots.txt<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to check your site&#8217;s <strong>robots.txt <\/strong>file, you can view it by adding <strong>robots.txt<\/strong> after your site&#8217;s URL, for example, <strong>www.myname.com\/robots.txt<\/strong>. You can edit it through your web hosting control panel\u2019s file manager, or an <a data-click-id=\"hgr-post-content-link-ftp-client\" href=\"\/tutorials\/ftp\/filezilla-ftp-configuration\/\" target=\"_blank\" rel=\"noopener\">FTP client<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To edit robots.txt using Hostinger File Manager:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Log in to your Hostinger account and navigate to <strong>Websites<\/strong>.<\/li>\n\n\n\n<li>Select your website and click <strong>Manage site<\/strong>.<\/li>\n\n\n\n<li>Go to <strong>Files \u2192 File Manager<\/strong>.<\/li>\n\n\n\n<li>Open the <code>public_html<\/code> directory and locate <code>robots.txt<\/code>.<\/li>\n\n\n\n<li>Edit the existing file, or create a new file named <code>robots.txt<\/code> if one doesn&#8217;t exist.<\/li>\n\n\n\n<li>Save your changes and deploy them if your File Manager requires deployment.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Before replacing existing rules, review them carefully to avoid accidentally blocking important pages or resources.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a data-click-id=\"hgr-post-content-link-hostinger-com-tutorials-wp-content-uploads-sites-2-2023-03-h\" 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>\n\n\n<p class=\"wp-block-paragraph\">If the file isn\u2019t 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>\n\n\n\n<p class=\"wp-block-paragraph\">Now you can start adding commands to the file. The two main ones you should know are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>User-agent<\/strong> \u2013 refers to the type of bot that will be restricted, such as <a data-click-id=\"hgr-post-content-link-googlebot\" href=\"https:\/\/developers.google.com\/search\/docs\/crawling-indexing\/googlebot\" target=\"_blank\" rel=\"noreferrer noopener\">Googlebot<\/a> or <a data-click-id=\"hgr-post-content-link-bingbot\" 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>\u2013 is where you want to restrict the bots.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s look at an example. If you want to prevent Google\u2019s bot from crawling on a specific folder of your site, you can put this command in the file:<\/p>\n\n\n\n<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\u00a0\nDisallow: \/example-subfolder\/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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>\n\n\n\n<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>\n\n\n\n<p class=\"wp-block-paragraph\">To ask all compliant crawlers not to access your entire website, use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">User-agent: *\nDisallow: \/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The asterisk applies the rule to all compliant crawlers, while <code>\/<\/code> matches every URL path on the site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t apply this rule to a live website that you want search engines to crawl. It can prevent search engines from discovering updates or reading content, but it doesn&#8217;t guarantee that previously discovered URLs will disappear from search results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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>\n\n\n\n<h2 id=\"h-how-to-verify-your-robots-txt-rules\" class=\"wp-block-heading h-t-title-2\">How to verify your robots.txt rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After saving your changes, open <code>https:\/\/example.com\/robots.txt<\/code> in your browser and confirm that the file is publicly accessible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then check the configuration using the robots.txt report in Google Search Console. This helps identify whether Google can fetch the file and whether it encounters problems processing it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Search Console only covers Google&#8217;s crawlers. To see whether your rules also block AI crawlers like GPTBot, ClaudeBot or PerplexityBot, test your site with an <a data-click-id=\"hgr-post-content-link-ai-readiness-checker\" href=\"https:\/\/www.hostinger.com\/ai-visibility-checker\">AI readiness checker<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;ve added rules to block specific directories, review their paths carefully. A misplaced slash or overly broad Disallow rule can prevent crawlers from accessing important content.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remember that changes to robots.txt may take time to appear in crawler behavior, since search engines can temporarily cache the file.<\/p>\n\n\n\n<h2 id=\"h-next-steps-review-your-websites-crawl-settings\" class=\"wp-block-heading h-t-title-2\">Next steps: Review your website&#8217;s crawl settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After configuring robots.txt, review which pages and directories you&#8217;ve restricted. Make sure search engines can still crawl the important content you want visitors to find.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your goal is to remove specific pages from search results, use an appropriate indexing directive instead of relying on robots.txt alone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check Google Search Console regularly for crawling issues, especially after making major changes to your website structure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can block search engine crawlers from accessing specific pages, directories, or your entire website using the Disallow directive in [&#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":161357,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to block crawlers using robots.txt disallow","rank_math_description":"Learn how to use robots.txt Disallow rules to control search engine crawling. See examples, understand indexing limitations, and test your configuration.","rank_math_focus_keyword":"robots txt disallow all","_content_updated_date":"2019-09-13","footnotes":""},"categories":[22617,22619],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","has-post-thumbnail","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-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-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-block-search-engines-using-robotstxt","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-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},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-bloquear-los-motores-de-busqueda-utilizando-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":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/como-criar-robots-txt-bloquear-mecanismos-busca\/","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":23,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/687\/revisions"}],"predecessor-version":[{"id":162106,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/687\/revisions\/162106"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/161357"}],"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}]}}