{"id":2238,"date":"2007-04-11T20:37:11","date_gmt":"2007-04-11T15:07:11","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/"},"modified":"2026-11-04T16:55:14","modified_gmt":"2026-11-04T11:25:14","slug":"add-sitemaps-autodiscovery-in-robotstxt-file","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/","title":{"rendered":"How to Add Sitemap to Robots.txt (2026 Guide)"},"content":{"rendered":"<p>Want to add sitemap to robots.txt so search engines find it? You should. In April 2007, Google, Yahoo!, Microsoft and Ask.com announced support for sitemap autodiscovery: by adding one line to your robots.txt file, every search engine can find your XML sitemap without you submitting it to each one. The same file is also where you can <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2026\/11\/block-ai-crawlers\/\">block AI crawlers<\/a> such as GPTBot. Nearly 20 years later, this is still one of the simplest SEO tasks. Here is how to add a sitemap to robots.txt in 2026, with examples for WordPress.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-large wp-image-63857\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/sitemap-robots-txt-1024x538.webp\" alt=\"Add sitemap to robots.txt\" width=\"1024\" height=\"538\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/sitemap-robots-txt-1024x538.webp 1024w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/sitemap-robots-txt-300x158.webp 300w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/sitemap-robots-txt-150x79.webp 150w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/sitemap-robots-txt-768x403.webp 768w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/sitemap-robots-txt.webp 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><strong>Quick answer:<\/strong> To add a sitemap to robots.txt, add a line with the full sitemap URL anywhere in the file, for example <code>Sitemap: https:\/\/www.example.com\/sitemap_index.xml<\/code>. Use an absolute URL, add one line per sitemap, and also submit the sitemap in Google Search Console and Bing Webmaster Tools.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_90 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6b04c658299a8\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #1a202c;color:#1a202c\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #1a202c;color:#1a202c\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6b04c658299a8\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#How_to_add_a_sitemap_to_robotstxt\" >How to add a sitemap to robots.txt<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Add_a_sitemap_to_robotstxt_in_WordPress\" >Add a sitemap to robots.txt in WordPress<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Rules_for_the_sitemap_line\" >Rules for the sitemap line<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Submit_your_sitemap_too\" >Submit your sitemap too<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#What_changed_since_2007\" >What changed since 2007?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#FAQ\" >FAQ<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Is_it_necessary_to_add_a_sitemap_to_robotstxt\" >Is it necessary to add a sitemap to robots.txt?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Where_should_the_sitemap_line_go_in_robotstxt\" >Where should the sitemap line go in robots.txt?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Can_I_add_more_than_one_sitemap\" >Can I add more than one sitemap?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/add-sitemaps-autodiscovery-in-robotstxt-file\/#Does_Google_still_read_sitemaps_in_robotstxt\" >Does Google still read sitemaps in robots.txt?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_to_add_a_sitemap_to_robotstxt\"><\/span>How to add a sitemap to robots.txt<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Find your sitemap URL. WordPress core creates <code>\/wp-sitemap.xml<\/code>; SEO plugins like Rank Math and Yoast use <code>\/sitemap_index.xml<\/code>.<\/li>\n<li>Open your robots.txt file at the root of your site (yoursite.com\/robots.txt).<\/li>\n<li>Add the Sitemap line with the full URL:\n<pre><code>User-agent: *\r\nDisallow: \/wp-admin\/\r\nAllow: \/wp-admin\/admin-ajax.php\r\n\r\nSitemap: https:\/\/www.example.com\/sitemap_index.xml<\/code><\/pre>\n<\/li>\n<li>Save the file and open yoursite.com\/robots.txt in a browser to check it.<\/li>\n<\/ol>\n<p>The Sitemap line is independent of User-agent groups, so it can go at the top or bottom. See also <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2007\/04\/the-correct-way-to-add-sitemap-link-to-robotstxt-file\/\">the correct way to add a sitemap link to robots.txt<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Add_a_sitemap_to_robotstxt_in_WordPress\"><\/span>Add a sitemap to robots.txt in WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>No physical robots.txt:<\/strong> WordPress serves a virtual robots.txt and adds the core sitemap automatically in recent versions.<\/li>\n<li><strong>Rank Math:<\/strong> go to Rank Math &gt; General Settings &gt; Edit robots.txt. Rank Math adds the sitemap line for you when its sitemap is enabled.<\/li>\n<li><strong>Yoast SEO:<\/strong> use Yoast SEO &gt; Tools &gt; File editor, and add the Sitemap line if it is missing.<\/li>\n<li><strong>Physical file:<\/strong> if a robots.txt file exists in your site root, it overrides the virtual one, so edit it by FTP or your host&#8217;s file manager.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Rules_for_the_sitemap_line\"><\/span>Rules for the sitemap line<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Use the full absolute URL, including https:\/\/ and the right www or non-www version.<\/li>\n<li>You can list several sitemaps, one per line, or point to a sitemap index file.<\/li>\n<li>A sitemap can list up to 50,000 URLs or 50 MB uncompressed; use an index for more, as defined by <a href=\"https:\/\/www.sitemaps.org\/protocol.html\" target=\"_blank\" rel=\"noopener\">sitemaps.org<\/a>.<\/li>\n<li>Do not block the sitemap URL itself with a Disallow rule.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Submit_your_sitemap_too\"><\/span>Submit your sitemap too<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Robots.txt autodiscovery helps every crawler find your sitemap, but you also get reports when you submit it directly:<\/p>\n<ul>\n<li><a href=\"https:\/\/search.google.com\/search-console\/about\" target=\"_blank\" rel=\"noopener\">Google Search Console<\/a>: Indexing &gt; Sitemaps &gt; add your sitemap URL.<\/li>\n<li><a href=\"https:\/\/www.bing.com\/webmasters\/about\" target=\"_blank\" rel=\"noopener\">Bing Webmaster Tools<\/a>: Sitemaps &gt; Submit sitemap.<\/li>\n<\/ul>\n<p>Google retired its old sitemap &#8220;ping&#8221; URL in 2023, so plugins no longer need to ping Google on every post. Bing and other engines support IndexNow for faster updates.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_changed_since_2007\"><\/span>What changed since 2007?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In 2007 I used the Google Sitemaps Generator WordPress plugin, which pinged Google and Yahoo! on every new post, and Ask.com, Google, Microsoft Live Search and Yahoo! had just agreed to support autodiscovery. Today Yahoo! search uses Bing, Live Search became Bing, and Ask.com no longer runs its own crawler, but the Sitemap line in robots.txt still works the same way.<\/p>\n<p>Want to keep some pages out of search instead? See <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2005\/01\/ways-to-prevent-search-engines-from-indexing-your-private-site\/\">ways to prevent search engines from indexing your site<\/a>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"FAQ\"><\/span>FAQ<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Is_it_necessary_to_add_a_sitemap_to_robotstxt\"><\/span>Is it necessary to add a sitemap to robots.txt?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>It is not required, but it is a free, easy way to help all search engines find your sitemap.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Where_should_the_sitemap_line_go_in_robotstxt\"><\/span>Where should the sitemap line go in robots.txt?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Anywhere in the file. Many sites put it at the end.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can_I_add_more_than_one_sitemap\"><\/span>Can I add more than one sitemap?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes. Add one Sitemap line for each, or use a single sitemap index.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Does_Google_still_read_sitemaps_in_robotstxt\"><\/span>Does Google still read sitemaps in robots.txt?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes. Google discovers sitemaps listed in robots.txt, and you can also submit them in Search Console.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Want to add sitemap to robots.txt so search engines find it? You should. In April 2007, Google, Yahoo!, Microsoft and&#8230;<\/p>\n","protected":false},"author":4,"featured_media":63857,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"default","_kad_post_title":"default","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"default","_kad_post_vertical_padding":"default","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6,41],"tags":[],"class_list":["post-2238","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogging","category-search-engine-optimization"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=2238"}],"version-history":[{"count":3,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2238\/revisions"}],"predecessor-version":[{"id":69471,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/2238\/revisions\/69471"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media\/63857"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=2238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=2238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=2238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}