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. Robots.txt - Googlebot - Allow... what's it for?

    Robots.txt - Googlebot - Allow... what's it for?

    Intermediate & Advanced SEO
    5 4 3.0k
    • 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.
    • McTaggart
      McTaggart last edited by

      Hello - I just came across this in robots.txt for the first time, and was wondering why it is used? Why would you have to proactively tell Googlebot to crawl JS/CSS and why would you want it to? Any help would be much appreciated - thanks, Luke

      User-Agent: Googlebot

      Allow: /.js

      Allow: /.css

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

        Hi Luke

        As you have correctly assumed, that particular robots command would be pointless.

        The Googlebot does follow allow commands (while other ones do not), but it should only be used if it is an exception to a disallow rule.

        So, for example, if you had a rule that blocked pages within a sub-directory, with:

        Disallow: /example/*

        You could create an allow rule that indexes a specific page within that directory to be indexed, like:

        Allow: /example/page.html

        Couple of things to point out here.  "At a group-member level, in particular for allow and disallow directives, the most specific rule based on the length of the [path] entry will trump the less specific (shorter) rule." (Google Source).  In this example, because the more specific rule is the allow rule, that will prevail.  It is also best practice to put your "allow" rules at the top of the robots.txt file.

        But in your example, if they have allow rules for JS and CSS files without having disavow rules for those directories/paths etc - it's a waste of space.  Google will attempt to crawl anything it can by default - unless you disavow access.

        TL;DR - You don't need to proactively tell Google to crawl CSS and JS - it will by default.

        Hope this helps.

        CleverPhD McTaggart 2 Replies Last reply Reply Quote 5
        • Guest
          Guest last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 3
          • CleverPhD
            CleverPhD @TomRayner last edited by

            Just as a follow-up to Tom's great post.  If you were wanting to test a robots.txt setup, especially if you were using a wildcard or using an allow combined with a disallow, Google Search Console under the Crawl section has a robots.txt Tester.  You will see your most recent robots.txt file there that Google has a copy of.  You can then modify that version and then enter a URL at the bottom to see if everything is set correctly or not.  It is pretty handy, especially if you have a big robots.txt file.   Note that this tool does not change how Google crawls your site or your robots.txt file, it is just for testing.  Once you find the configuration that works, you would still need to update the robots.txt on your server.

            1 Reply Last reply Reply Quote 3
            • McTaggart
              McTaggart @TomRayner last edited by

              Thanks Tom - that's very useful - appreciated 🙂 - and thanks also Clever PhD re: the robots.txt tester info - Luke

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Migrating From Parameter-Driven URL's to 'SEO Friendly URL's (Slugs)
                PatrickDelehanty
                PatrickDelehanty
                0
                2
                292

              • Google's 'related:' operator
                EpicWebStudios
                EpicWebStudios
                0
                5
                209

              • Any issue? Redirect 100's of domains into one website's internal pages
                Chris.Menke
                Chris.Menke
                0
                4
                116

              • Site Structure: How do I deal with a great user experience that's not the best for Google's spiders?
                KristinaKledzik
                KristinaKledzik
                0
                3
                138

              • Should I disallow via robots.txt for my sub folder country TLD's?
                eyepaq
                eyepaq
                0
                2
                241

              • There's a website I'm working with that has a .php extension. All the pages do. What's the best practice to remove the .php extension across all pages?
                digisavvy
                digisavvy
                0
                5
                445

              • Pro's & Con's of registering your customers?
                Marcus_Miller
                Marcus_Miller
                0
                3
                496

              • Robots.txt: Link Juice vs. Crawl Budget vs. Content 'Depth'
                rishil
                rishil
                0
                5
                1.5k

              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