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
          • International XML Sitemaps - Standalone, or Integrate into Existing XML Sitemap?
            Martijn_Scheijbeler
            Martijn_Scheijbeler
            0
            2
            138

          • Google Processing but Not Indexing XML Sitemap
            Kingof5
            Kingof5
            0
            4
            1.5k

          • XML Sitemap Indexation Rate Decrease
            DanDeceuster
            DanDeceuster
            0
            3
            210

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

          • Best way to get pages indexed fast?
            Michael-Goode
            Michael-Goode
            0
            6
            1.4k

          • 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

          • 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