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.
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>
<IfModule mod_rewrite.c>
<Files ~ “^(sitemap_index|sitemap-mobile|sitemap-image|sitemap).xml$”>
Header set X-Robots-Tag “noindex”
</Files>
</IfModule>