Prevent XML sitemaps from showing up in Google search results

A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines like Google read this file to more intelligently crawl your site. A sitemap tells the crawler which files you think are important in your site, and also provides valuable information about these files: for example, for pages, when the page was last updated, how often the page is changed, and any alternate language versions of a page.

Google will be crawled and indexed if sitemap stored in the hosting directory. Technical its possible to deny access using robot.txt file by using following code. This will deny accessing sitemap from Search Engines.

User-agent: *
Disallow: /sitemap.xml

If you want to remove sitemap from Google Search result then add the following code in the .htaccess file. “noindex” is readable but wont index.

<IfModule mod_rewrite.c>
    <Files sitemap.xml>
        Header set X-Robots-Tag "noindex"
    </Files>
</IfModule>

You can use a sitemap to provide information about specific types of content on your pages, including video and image content. For example:

  • A sitemap video entry can specify the video running time, category, and age appropriateness rating.
  • A sitemap image entry can include the image subject matter, type, and license.

If you have more than one sitemap then user following code to prevent from indexing.

<IfModule mod_rewrite.c>
    <Files ~ "^(sitemap1|sitemap2|sitemap3)\.xml>
        Header set X-Robots-Tag "noindex"
    </Files>
</IfModule>

Alternatively you could delete the sitemap and  submit the sitemap through Google Webmaster Tool and include a Sitemap.

Leave a Reply

Your email address will not be published. Required fields are marked *