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

    Robots.txt

    Technical SEO Issues
    5 3 760
    • 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.
    • BailHotline
      BailHotline last edited by

      Hello Everyone,

      The problem I'm having is not knowing where to have the robots.txt file on our server.

      We have our main domain (company.com) with a robots.txt file in the root of the site, but we also have our blog (company.com/blog) where were trying to disallow certain directories from being crawled for SEO purposes...

      Would having the blog in the sub-directory still need its own robots.txt? or can I reference the directories i don't want crawled within the blog using the root robots.txt file?

      Thanks for your insight on this matter.

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

        You only need a robot file at your main directory and it is used for the whole website.

        If you want to have more info's about robots.txt, there is an very good post from Lindsay: http://www.seomoz.org/blog/robot-access-indexation-restriction-techniques-avoiding-conflicts

        With this I think it will be easier for you to go pro in robots files. Good luck!

        BailHotline 1 Reply Last reply Reply Quote 1
        • BailHotline
          BailHotline @Naghirniac last edited by

          Thanks Naghimiac,

          Your link is very resourceful, but on the other hand I was looking for something more specific as to blogs being in a sub-directory. I know by default WordPress has its own .htaccess file in the root of the blog directory and I have a separate .htaccess file in the root of my main domain. This is why I was thinking it needed its own robots.txt file.

          Is the robot.txt known for only being in the root level of the main directory even if a blog is in a sub-directory?

          john4math BailHotline 2 Replies Last reply Reply Quote 0
          • john4math
            john4math @BailHotline last edited by

            The bots won't care about that.  If you have your site on www.company.com, your robots.txt will reside at www.company.com/robots.txt, and its directives will apply to any pages living under www.company.com.  When a bot comes to www.company.com/blog, it'll look for the robots.txt at www.company.com/robots.txt to see if it's allowed to crawl there.  It won't look in a subdirectory. Robots.txt always resides on the root level.

            If you had your blog at blog.company.com instead of company.com/blog, then you would have to have a separate robots.txt at blog.company.com/robots.txt.  As you have your blog in a subdirectory rather than a subdomain, one robots.txt is all you need.

            1 Reply Last reply Reply Quote 1
            • BailHotline
              BailHotline @BailHotline last edited by

              Thanks John & Naghimiac,

              Both your responses helped me understand the robots.txt file and the proper ways of implementing it.

              Thanks again for all your help!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • 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
                irvingw
                irvingw
                0
                4
                116

              • Robots.txt file
                Asher
                Asher
                0
                3
                261

              • Robots.txt
                Ontarioseo
                Ontarioseo
                0
                5
                737

              • Robots.txt and robots meta
                TheEspresseo
                TheEspresseo
                0
                5
                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