How to Prevent Sitemaps Showing in Search Results

You might have noticed sometimes while searching your own site on Google, that your sitemap file is also showing up in search results.Whenever you are trying to search, your sitemap also shows in Search result page and when you click on it, you would see list of URL that is annoying for readers and it may create negative impression on readers mind however sitemaps are important part of SEO.

Prevent Sitemaps Showing in SERP

You can use Google Sitemap generator plugins to Create Sitemap for your WordPress blog.But there is no reason to show sitemap on Search results. If your blog posts is ranking for some keyword, you would see your blog post along with sitemap with that link on SERP. Two result on search result page for no reason. Here in this article, we will discuss about how to prevent sitemap from indexing on SERP. You can simply add noindex tag to sitemap page in order to request that automated Internet bots avoid indexing it in future and noindex tag would tell search engines not to index that page.

How to prevent XML sitemap from Indexing

To add noindex tag in sitemap file, we’ll have to add  following code to the .htaccess file so that it will not be considered for indexing.

<IfModule mod_rewrite.c>
  <Files sitemap.xml>
   Header set X-Robots-Tag "noindex"
  </Files>
 </IfModule>
Replace sitemap.xml file with your sitemap file name.e.g.index_sitemap or sitemap_image.xml etc. If you have want to hide multiple sitemaps, you should use following code.
<IfModule mod_rewrite.c>
<Files ~ “^(sitemap_index|sitemap-mobile|sitemap-image|sitemap).xml$”>
Header set X-Robots-Tag “noindex”
</Files>
</IfModule>
Replace the name of sitemap with your sitemap and you have done, your sitepam pages you have added there will have noindex tag and you will not be able to see your sitemap pages on search results page again.