Prevent Search engines from indexing your XML sitemap file using Noindex x-robots tag

We know very well as sitemap is an important file for Seo to submit it to any search engine and it contain link for website  all pages, images and videos.
Sitemap also have text content and due to submit it in search engine it has higer possibility to index their content first before indexing other url content. So it is required to prevent search engines from indexing sitemaps files. But another confussion sitemap is xml  file if it is html file then you could easily do it by using a meta tag with Noindex value. In XMl file case it is not possible.

sitemap from search result

Solutions :
Set xml sitemap file X-Robots-tag is  no-index using .htacess file in Apache Sever.
Add below few line syntax in .htaccess file that are available at root directory of your website.

For a single sitemap file.

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

Replace sitemap.xml name with your sitemap xml file name.

For more than one sitemap file that you have in your Website.
<IfModule mod_rewrite.c>
<Files ~ “^(sitemap1|sitemap2|sitemap3)\.xml$”>
Header set X-Robots-Tag “noindex”
</Files>
</IfModule>

Leave a Comment

Scroll to Top