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. Technical SEO Issues
    4. Robots.txt Syntax

    Robots.txt Syntax

    Technical SEO Issues
    4 3 766
    • 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.
    • RodrigoStockebrand
      RodrigoStockebrand last edited by

      Does the order of the robots.txt syntax matter in SEO?

      For example (are there potential problems with this format):

      User-agent: *
      Sitemap: 
      Disallow: /form.htm
      Allow: /
      
      Disallow: /cgnet_directory
      
      
      1 Reply Last reply Reply Quote 0
      • dohertyjf
        dohertyjf last edited by

        Rodrigo -

        Good question. The syntax does in fact matter, though not necessarily for SEO rankings. It matters because if you screw up your robots.txt, you can inadvertently disallow your whole site (I did it last week. Not pretty. Blog post forthcoming).

        To get to your question, it is usually best to put the "Sitemap: " line at the bottom of the robots.txt, but it is not required to have it there, so far as I know.

        You do not need the Allow: / parameter, because if you leave it out, Google assumes that you want everything indexed except what is put in the "Disallow: " lines.

        In your case, you are disallowing "http://www.site.com/form.htm" and everything in your cgnet_directory folder. If you want everything in these folders hidden from crawlers...you have done exactly what you need to do.

        I'm still learning about this, so I'm open to any correction the rest of the community has.

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

          Thanks John- good response. I think the biggest takeaway for me is to know that none of the "dis-order" above will actually cause errors in the file. However, I completely agree with your recommendations as to where the sitemap: should go, and why the allow parameter is unnecessary.

          Last question, do you know if the blank line in-between the allow: and second disallow: parameter cause any issues?

          side note for those using the robots.txt to block content, also consider the noindex,follow attribute in the META tag as an alternative to save some link value that those pages may be getting.

          dohertyjf 1 Reply Last reply Reply Quote 0
          • dohertyjf
            dohertyjf @AlgoFreaks last edited by

            Rodrigo -

            Thanks, and thanks for the follow-up. To be honest with you though...I have not seen or experienced anything about this. I tend to follow the suggested rules with code 🙂

            So my answer is "I don't know". Anyone else know?

            I also agree with you on the meta tags. Robots.txt is best used for disallowing folders and such, not pages. For instance, I might do a "Disallow: /admin" in the robots.txt file, but would never block a category page or something to that effect. If I wanted to remove it from the index, I'd also use the meta "noindex,follow" attribute. Good point!

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Robots.txt Tester - syntax not understood
              JamesHancocks1
              JamesHancocks1
              0
              3
              573

            • Robots.txt Syntax for Dynamic URLs
              btreloar
              btreloar
              0
              5
              369

            • Robots.txt
              MarieHaynes
              MarieHaynes
              0
              8
              115

            • Robots.txt
              MichaelC-15022
              MichaelC-15022
              0
              7
              1.0k

            • Robots.txt
              Dan-Lawrence
              Dan-Lawrence
              0
              5
              99

            • Meta Robots Noindex and Robots.txt File
              Devanur-Rafi
              Devanur-Rafi
              0
              2
              125

            • Robots.txt
              BailHotline
              BailHotline
              0
              5
              760

            • Robots.txt
              Tom-Anthony
              Tom-Anthony
              0
              4
              1.1k

            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