Sitemap In Google Search Results ?

Sitemap In Google Search Results ?

Do you have the problem where your site sitemap .xml file comes up in the google search result and want to fix this ? To illustrate what we are talking about we are using our site as an example (the sitemap result is to the right of the contact us sitelink);

 

After Change

 

This issue has come up a few times and some people have resulted in using their robot.txt file to block access to the file-this is not a good idea as it defeats the purpose of having a sitemap file in the first place if search engines cant access it.

The easy solution is to set the X-Robots tag in the xml file to no index- allowing it to be read but will not be included in the index, to do this -simply add the following code to your sites .htaccess file (adding noindex to all xml files);

<FilesMatch “.xml$”>
Header set X-Robots-Tag “noindex”
</FilesMatch>

When google updates your site, the link will be removed – problem solved, we hope this helps anyone struggling with this issue.