Lots of sites are using xml sitemaps to quickly index their blog on search engine.XML sitemaps are usually help search engine to index your webpage , images & video files available on your site. Suppose your website’s some pages are not indexed by search engine, but search engine would reach to that non indexed webpage from your site through your XML sitemap.
Now come to actual point, if you have created XML sitemap that is also set to index on Search Engine Results page(SERP), so whenever any users search the web, both your site webpage as well as XML sitemap comes together in search engine.This way your sitemap file is competing with your other web pages. If your website is HTML based, you can easily prevent your sitemap file getting indexed through meta tags.But there is no such thing available for your XML based sitemap.
Then How To Prevent Search Engine from Indexing XML Sitemaps :
<IfModule mod_rewrite.c><Files sitemap.xml> Header set X-Robots-Tag "noindex" </Files> </IfModule>
Add the above code to your .htaccess file & replace sitemap.xml to name with your xml sitemap. Generally sitemap.xml is default if you are using Google Sitemap Generator.if you are using SEO By Yoast to generate xml sitemap for your site, it will be sitemap_index.xml. This is simple .htaccess file modification to prevent your single xml sitemap from Search Engine.
How To Prevent Search Engine To index multiple Sxml sitemap :
<IfModule mod_rewrite.c> <Files ~ "^(sitemap1|sitemap2|sitemap3)\.xml$"> Header set X-Robots-Tag "noindex" </Files> </IfModule>
Use the above code if you are using more than one sitemap for your site. Replace sitemap1 | Sitemap2 with your sitemap file.
Also Check : How to prevent pages/posts from getting indexed