If I search Google for a term or my site name, Google returns the URL
sitename.com/sitemap.xml on the first or second page of the results.
I want the main site to return in the results and not the sitemap.
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
To remove the sitemap.xml file from your SERP, follow the steps outlined here: Google Webmaster Tools - Completely remove an entire page
To prevent this from being indexed again, add
X-Robots-Tag: noindex to the header response for the URL to your sitemap.xml in your web server configuration, as indicated here.
An example for a
.htaccess file for Apache would be:
<FilesMatch "sitemap\.xml"> Header set X-Robots-Tag "noindex" </FilesMatch>