• seohunters9

        See all notifications

        Skip to content
        Moz logo Menu open Menu close
        • Products
          • Moz Pro
          • Moz Pro Home
          • Moz Local
          • Moz Local Home
          • STAT
          • Moz API
          • Moz API Home
          • Compare SEO Products
          • Moz Data
        • Free SEO Tools
          • Domain Analysis
          • Keyword Explorer
          • Link Explorer
          • Competitive Research
          • MozBar
          • More Free SEO Tools
        • Learn SEO
          • Beginner's Guide to SEO
          • SEO Learning Center
          • Moz Academy
          • MozCon
          • Webinars, Whitepapers, & Guides
        • Blog
        • Why Moz
          • Digital Marketers
          • Agency Solutions
          • Enterprise Solutions
          • Small Business Solutions
          • The Moz Story
          • New Releases
        • Log in
        • Log out
        • Products
          • Moz Pro

            Your all-in-one suite of SEO essentials.

          • Moz Local

            Raise your local SEO visibility with complete local SEO management.

          • STAT

            SERP tracking and analytics for enterprise SEO experts.

          • Moz API

            Power your SEO with our index of over 44 trillion links.

          • Compare SEO Products

            See which Moz SEO solution best meets your business needs.

          • Moz Data

            Power your SEO strategy & AI models with custom data solutions.

          Let your business shine with Listings AI
          Moz Local

          Let your business shine with Listings AI

          Learn more
        • Free SEO Tools
          • Domain Analysis

            Get top competitive SEO metrics like DA, top pages and more.

          • Keyword Explorer

            Find traffic-driving keywords with our 1.25 billion+ keyword index.

          • Link Explorer

            Explore over 40 trillion links for powerful backlink data.

          • Competitive Research

            Uncover valuable insights on your organic search competitors.

          • MozBar

            See top SEO metrics for free as you browse the web.

          • More Free SEO Tools

            Explore all the free SEO tools Moz has to offer.

          NEW Keyword Suggestions by Topic
          Moz Pro

          NEW Keyword Suggestions by Topic

          Learn more
        • Learn SEO
          • Beginner's Guide to SEO

            The #1 most popular introduction to SEO, trusted by millions.

          • SEO Learning Center

            Broaden your knowledge with SEO resources for all skill levels.

          • On-Demand Webinars

            Learn modern SEO best practices from industry experts.

          • How-To Guides

            Step-by-step guides to search success from the authority on SEO.

          • Moz Academy

            Upskill and get certified with on-demand courses & certifications.

          • MozCon

            Save on Early Bird tickets and join us in London or New York City

          Unlock flexible pricing & new endpoints
          Moz API

          Unlock flexible pricing & new endpoints

          Find your plan
        • Blog
        • Why Moz
          • Digital Marketers

            Simplify SEO tasks to save time and grow your traffic.

          • Small Business Solutions

            Uncover insights to make smarter marketing decisions in less time.

          • Agency Solutions

            Earn & keep valuable clients with unparalleled data & insights.

          • Enterprise Solutions

            Gain a competitive edge in the ever-changing world of search.

          • The Moz Story

            Moz was the first & remains the most trusted SEO company.

          • New Releases

            Get the scoop on the latest and greatest from Moz.

          Surface actionable competitive intel
          New Feature

          Surface actionable competitive intel

          Learn More
        • Log in
          • Moz Pro
          • Moz Local
          • Moz Local Dashboard
          • Moz API
          • Moz API Dashboard
          • Moz Academy
        • Avatar
          • Moz Home
          • Notifications
          • Account & Billing
          • Manage Users
          • Community Profile
          • My Q&A
          • My Videos
          • Log Out

        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. Home
        2. SEO Tactics
        3. Intermediate & Advanced SEO
        4. Block an entire subdomain with robots.txt?

        Moz Q&A is closed.

        After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

        Block an entire subdomain with robots.txt?

        Intermediate & Advanced SEO
        5
        16
        111633
        Loading More Posts
        • Watching

          Notify me of new replies.
          Show question in unread.

        • Not Watching

          Do not notify me of new replies.
          Show question in unread if category is not ignored.

        • Ignoring

          Do not notify me of new replies.
          Do not show question in unread.

        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as question
        Locked
        This topic has been deleted. Only users with question management privileges can see it.
        • kylesuss
          kylesuss last edited by

          Is it possible to block an entire subdomain with robots.txt?

          I write for a blog that has their root domain as well as a subdomain pointing to the exact same IP. Getting rid of the option is not an option so I'd like to explore other options to avoid duplicate content. Any ideas?

          1 Reply Last reply Reply Quote 12
          • kylesuss
            kylesuss @kylesuss last edited by

            Awesome! That did the trick -- thanks for your help. The site is no longer listed 🙂

            1 Reply Last reply Reply Quote 1
            • sprynewmedia
              sprynewmedia @kylesuss last edited by

              Fact is, the robots file alone will never work (the link has a good explanation why - short form: all it does is stop the bots from indexing again).

              Best to request removal then wait a few days.

              1 Reply Last reply Reply Quote 3
              • kylesuss
                kylesuss @kylesuss last edited by

                Yeah. As of yet, the site has not been de-indexed. We placed the conditional rule in htaccess and are getting different robots.txt files for the domain and subdomain -- so that works. But I've never done this before so I don't know how long it's supposed to take?

                I'll try to verify via Webmaster Tools to speed up the process. Thanks

                1 Reply Last reply Reply Quote 0
                • sprynewmedia
                  sprynewmedia @kylesuss last edited by

                  You should do a remove request in Google Webmaster Tools.  You have to first verify the sub-domain then request the removal.

                  See this post on why the robots file alone won't work...

                  http://www.seomoz.org/blog/robot-access-indexation-restriction-techniques-avoiding-conflicts

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

                    Awesome. We used your second idea and so far it looks like it is working exactly how we want. Thanks for the idea.

                    Will report back to confirm that the subdomain has been de-indexed.

                    1 Reply Last reply Reply Quote 0
                    • sprynewmedia
                      sprynewmedia @kylesuss last edited by

                      Option 1 could come with a small performance hit if you have a lot of txt files being used on the server.

                      There shouldn't be any negative side effects to option 2 if the rewrite is clean (IE not accidently a redirect) and the content of the two files are robots compliant.

                      Good luck

                      1 Reply Last reply Reply Quote 2
                      • kylesuss
                        kylesuss @sprynewmedia last edited by

                        Thanks for the suggestion. I'll definitely have to do a bit more research into this one to make sure that it doesn't have any negative side effects before implementation

                        sprynewmedia kylesuss 6 Replies Last reply Reply Quote 0
                        • kylesuss
                          kylesuss @john4math last edited by

                          We have a plugin right now that places canonical tags, but unfortunately, the canonical for the subdomain points to the subdomain. I'll look around to see if I can tweak the settings

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

                            Sounds like (from other discussions) you may be stuck requiring a dynamic robot.txt file which detects what domain the bot is on and changes the content accordingly.  This means the server has to run all .txt file as (I presume) PHP.

                            Or, you could conditionally rewrite the /robot.txt URL to a new file according to sub-domain

                            RewriteEngine on
                            RewriteCond %{HTTP_HOST} ^subdomain.website.com$
                            RewriteRule ^robotx.txt$ robots-subdomain.txt

                            Then add:

                            User-agent: *
                            Disallow: /

                            to the robots-subdomain.txt file

                            (untested)

                            kylesuss 1 Reply Last reply Reply Quote 2
                            • john4math
                              john4math last edited by

                              Placing canonical tags isn't an option?  Detect that the page is being viewed through the subdomain, and if so, write the canonical tag on the page back to the root domain?

                              Or, just place a canonical tag on every page pointing back to the root domain (so the subdomain and root domain pages would both have them).  Apparently, it's ok to have a canonical tag on a page pointing to itself.  I haven't tried this, but if Matt Cutts says it's ok...

                              kylesuss 1 Reply Last reply Reply Quote 1
                              • kylesuss
                                kylesuss @AdoptionHelp last edited by

                                Hey Ryan,

                                I wasn't directly involved with the decision to create the subdomain, but I'm told that it is necessary to create in order to bypass certain elements that were affecting the root domain.

                                Nevertheless, it is a blog and the users now need to login to the subdomain in order to access the Wordpress backend to bypass those elements. Traffic for the site still goes to the root domain.

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

                                  They both point to the same location on the server? So there's not a different folder for the subdomain?

                                  If that's the case then I suggest adding a rule to your htaccess file to 301 the subdomain back to the main domain in exactly the same way people redirect from non-www to www or vice-versa. However, you should ask why the server is configured to have a duplicate subdomain? You might just edit your apache settings to get rid of that subdomain (usually done through a cpanel interface).

                                  Here is what your htaccess might look like:

                                  <ifmodule mod_rewrite.c="">RewriteEngine on
                                    # Redirect non-www to wwww
                                    RewriteCond %{HTTP_HOST} !^www.mydomain.org [NC]
                                    RewriteRule ^(.*)$ http://www.mydomain.org/$1 [R=301,L]</ifmodule>

                                  kylesuss 1 Reply Last reply Reply Quote 2
                                  • AndyKuiper
                                    AndyKuiper last edited by

                                    Not to me LOL 🙂 I think you'll need someone with a bit more expertise in this area than I to assist in this case. Kyle, I'm sorry I couldn't offer more assistance... but I don't want to tell you something if I'm not 100% sure. I suspect one of the many bright SEOmozer's will quickly come to the rescue on this one.

                                    Andy 🙂

                                    1 Reply Last reply Reply Quote 1
                                    • kylesuss
                                      kylesuss @AndyKuiper last edited by

                                      Hey Andy,

                                      Herein lies the problem. Since the domain and subdomain point to the exact same place, they both utilize the same robots.txt file.

                                      Does that make sense?

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

                                        Hi Kyle 🙂 Yes, you can block an entire subdomain via robots.txt, however you'll need to create a robots.txt file and place it in the root of the subdomain, then add the code to direct the bots to stay away from the entire subdomain's content.

                                        User-agent: *
                                        Disallow: /

                                        hope this helps 🙂

                                        kylesuss 1 Reply Last reply Reply Quote 3
                                        • 1 / 1
                                        • First post
                                          Last post

                                        Browse Questions

                                        Explore more categories

                                        • Moz Tools

                                          Chat with the community about the Moz tools.

                                        • SEO Tactics

                                          Discuss the SEO process with fellow marketers

                                        • Community

                                          Discuss industry events, jobs, and news!

                                        • Digital Marketing

                                          Chat about tactics outside of SEO

                                        • Research & Trends

                                          Dive into research and trends in the search industry.

                                        • Support

                                          Connect on product support and feature requests.

                                        • See all categories

                                        Related Questions

                                        • Ty1986

                                          How to create a smooth blog migration from subdomain to subfolder main?

                                          Hi mozzers, We have decided to migrate the blog subdomain to the domain's subfolder (blog.example.com to example.com/blog). To do this the most effective way and avoid impact SEO negatively I believe I have to follow this checklist: Create a list of all 301 redirects from blog.example.com/post-1 to example.com/post-1 Make sure title tags remain the same on main domain Make sure internal links remain the same Is there something else I am missing? Any other best practices? I also would like to have all blog post as AMPs. Any recommendations if this something we should do since we are not a media site? Any other tips on successfully implementing those types of pages? Thanks

                                          Intermediate & Advanced SEO | | Ty1986
                                          1
                                        • jamiegriz

                                          SEO Best Practices regarding Robots.txt disallow

                                          I cannot find hard and fast direction about the following issue: It looks like the Robots.txt file on my server has been set up to disallow "account" and "search" pages within my site, so I am receiving warnings from the Google Search console that URLs are being blocked by Robots.txt. (Disallow: /Account/ and Disallow: /?search=). Do you recommend unblocking these URLs? I'm getting a warning that over 18,000 Urls are blocked by robots.txt. ("Sitemap contains urls which are blocked by robots.txt"). Seems that I wouldn't want that many urls blocked. ? Thank you!!

                                          Intermediate & Advanced SEO | | jamiegriz
                                          0
                                        • andyheath

                                          Will disallowing URL's in the robots.txt file stop those URL's being indexed by Google

                                          I found a lot of duplicate title tags showing in Google Webmaster Tools. When I visited the URL's that these duplicates belonged to, I found that they were just images from a gallery that we didn't particularly want Google to index. There is no benefit to the end user in these image pages being indexed in Google. Our developer has told us that these urls are created by a module and are not "real" pages in the CMS. They would like to add the following to our robots.txt file Disallow: /catalog/product/gallery/ QUESTION: If the these pages are already indexed by Google, will this adjustment to the robots.txt file help to remove the pages from the index? We don't want these pages to be found.

                                          Intermediate & Advanced SEO | | andyheath
                                          0
                                        • Malika1

                                          If Robots.txt have blocked an Image (Image URL) but the other page which can be indexed has this image, how is the image treated?

                                          Hi MOZers, This probably is a dumb question but I have a case where the robots.tags has an image url blocked but this image is used on a page (lets call it Page A) which can be indexed. If the image on Page A has an Alt tags, then how is this information digested by crawlers? A) would Google totally ignore the image and the ALT tags information? OR B) Google would consider the ALT tags information? I am asking this because all the images on the website are blocked by robots.txt at the moment but I would really like website crawlers to crawl the alt tags information. Chances are that I will ask the webmaster to allow indexing of images too but I would like to understand what's happening currently. Looking forward to all your responses 🙂 Malika

                                          Intermediate & Advanced SEO | | Malika1
                                          1
                                        • EvansHunt

                                          Wildcarding Robots.txt for Particular Word in URL

                                          Hey All, So I know that this isn't a standard robots.txt, I'm aware of how to block or wildcard certain folders but I'm wondering whether it's possible to block all URL's with a certain word in it? We have a client that was hacked a year ago and now they want us to help remove some of the pages that were being autogenerated with the word "viagra" in it. I saw this article and tried implementing it https://builtvisible.com/wildcards-in-robots-txt/ and it seems that I've been able to remove some of the URL's (although I can't confirm yet until I do a full pull of the SERPs on the domain). However, when I test certain URL's inside of WMT it still says that they are allowed which makes me think that it's not working fully or working at all. In this case these are the lines I've added to the robots.txt Disallow: /*&viagra Disallow: /*&Viagra I know I have the solution of individually requesting URL's to be removed from the index but I want to see if anybody has every had success with wildcarding URL's with a certain word in their robots.txt? The individual URL route could be very tedious. Thanks! Jon

                                          Intermediate & Advanced SEO | | EvansHunt
                                          0
                                        • carlod

                                          Complimentary sub-brand; subdomain, subfolder, something else?

                                          Hello forum! I have a question about subdomains vs. subfolders for a new sub-brand for a company. The company is looking at creating a sub-brand delivering a different service to the parent company. It is complimentary in a sense, but it would need a very different marketing strategy. It is not trying to 'hide' its parent brand at all, but instead would leverage the parent brand as added social proof. I've read that creating a subdomain essentially means starting from scratch in terms of SEO, and that a subfolder would better leverage the domain authority the TLD has accrued. However, creating a subfolder does not really gel with me, as it would not in my opinion provide a good experience for visitors. I.e. it's like running a website that sells electronics and having a subfolder marketing IT support services. Yes, there is some synergy-- but it can also lead to visitor confusion. I'd love your opinions on this! Carlo

                                          Intermediate & Advanced SEO | | carlod
                                          0
                                        • julienraby

                                          Redirect a subdomain to a subdirectory for SEO purposes.

                                          Hi, I have a site on wordpress and I want to add eCommerce to it. We want to go with Shopify but Shopify only allows to host their platform on a subdomain. I like to have it on a subdorectory, so my question is: Would it make sense to redirect the whole subdomain to a subdirectory (move everything from shop.domain.com to domain.com/shop) for SEO purposes? Would Google see these pages as if they were part of the main domain? Thanks! Julien

                                          Intermediate & Advanced SEO | | julienraby
                                          0
                                        • iAnalyst.com

                                          Create a new XML Sitemap for a blog subdomain?

                                          What would be the best way to go about this? A site just put a blog on http://blog.domain.com/ Should there be a separate XML Sitemap for that particular subdomain or should the original XML Sitemap for the main domain be sufficient? Looking forward to your responses. Thanks

                                          Intermediate & Advanced SEO | | iAnalyst.com
                                          0

                                        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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                                        • Accessibility
                                        • Terms of Use
                                        • Privacy

                                        Looks like your connection to Moz was lost, please wait while we try to reconnect.