The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Intermediate & Advanced SEO
    4. Is there a way to keep sitemap.xml files from getting indexed?

    Is there a way to keep sitemap.xml files from getting indexed?

    Intermediate & Advanced SEO
    3 2 288
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • irvingw
      irvingw last edited by

      Wow, I should know the answer to this question.

      Sitemap.xml files have to be accessible to the bots for indexing they can't be disallowed in robots.txt and can't block the folder at the server level.

      So how can you allow the bots to crawl these xml pages but have them not show up in google's index when doing a site: command search, or is that even possible? Hmmm

      1 Reply Last reply Reply Quote 0
      • intSchools
        intSchools last edited by

        Usually you would need to add noindex to the meta robots tag in the of your web page. Because your sitemap is an XML file and not HTML you will need to do things differently.

        You can add the code below to your .htaccess file, which you can find in the ROOT folder of your server. Open the file in a plain text editor and insert the following:

        Header set X-Robots-Tag "noindex"

        This will stop search engines indexing your sitemap without restricting them from crawling it.

        Note: Replace 'sitemap.xml' with your file name - if different.

        1 Reply Last reply Reply Quote 1
        • irvingw
          irvingw last edited by

          ahhh no index in .htaccess file. brilliant - thanks!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • Only a fraction of the sitemap get indexed
            JohnSammon
            JohnSammon
            0
            2
            46

          • Google Not Indexing XML Sitemap Images
            bogdan_c
            bogdan_c
            0
            17
            11.4k

          • XML Sitemap index within a XML sitemaps index
            Martijn_Scheijbeler
            Martijn_Scheijbeler
            0
            2
            1.1k

          • How can I get an XML sitemap in the order that I want?
            Marcus_Miller
            Marcus_Miller
            0
            4
            293

          • XML Sitemap Index Percentage (Large Sites)
            Sam_McRoberts
            Sam_McRoberts
            0
            2
            832

          • Most Painless way of getting Duff Pages out of SE's Index
            RyanKent
            RyanKent
            0
            3
            576

          • Best way to stop pages being indexed and keeping PageRank
            Sebes
            Sebes
            0
            2
            825

          • Can a XML sitemap index point to other sitemaps indexes?
            KeriMorgret
            KeriMorgret
            0
            3
            1.9k

          Get started with Moz Pro!

          Unlock the power of advanced SEO tools and data-driven insights.

          Start my free trial
          Products
          • Moz Pro
          • Moz Local
          • Moz API
          • Moz Data
          • STAT
          • Product Updates
          Moz Solutions
          • SMB Solutions
          • Agency Solutions
          • Enterprise Solutions
          • Digital Marketers
          Free SEO Tools
          • Domain Authority Checker
          • Link Explorer
          • Keyword Explorer
          • Competitive Research
          • Brand Authority Checker
          • Local Citation Checker
          • MozBar Extension
          • MozCast
          Resources
          • Blog
          • SEO Learning Center
          • Help Hub
          • Beginner's Guide to SEO
          • How-to Guides
          • Moz Academy
          • API Docs
          About Moz
          • About
          • Team
          • Careers
          • Contact
          Why Moz
          • Case Studies
          • Testimonials
          Get Involved
          • Become an Affiliate
          • MozCon
          • Webinars
          • Practical Marketer Series
          • MozPod
          Connect with us

          Contact the Help team

          Join our newsletter
          Moz logo
          © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
          • Accessibility
          • Terms of Use
          • Privacy