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. On-Page / Site Optimization
    4. How to exclude URL filter searches in robots.txt

    How to exclude URL filter searches in robots.txt

    On-Page / Site Optimization
    9 4 8.6k
    • 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.
    • neenor
      neenor last edited by

      When I look through my MOZ reports I can see it's included 'pages' which it shouldn't have included i.e. adding filtering rules such as this one http://www.mydomain.com/brands?color=364&manufacturer=505

      How can I exclude all of these filters in the robots.txt? I think it'll be:

      Disallow: /*?color=$

      Is that the correct syntax with the $ sign in it? Thanks!

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

        Hi

        I would recommend excluding these in Google Webmaster Tools. Once logged in to your account under the "Crawl" menu you will find "URL Parameters". Find the relevant parameter in the list on this page and you can tell Google not to index these pages.

        Hope this helps.

        Steve

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

          I sought out the answer from a developer and got the following reply, so posting here in case it helps someone else:

          To exclude pages with color or manufacture in them you can use

          Disallow: /*?color=
           Disallow: /
          ?*manufacturer=

          A  question mark in your try should be omitted as it denotes the end of the url

          1 Reply Last reply Reply Quote 0
          • neenor
            neenor @stever999 last edited by

            It's not Google's index that I'm interested in in this case, it's for the MOZ reports. Moz was including over 10,000 'pages' because it was indexing these URLs. Now I know how to edit the robots.txt Moz will be prevented from indexing them again (we only have around 2,000 real pages, not 10,000)

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

              Hello Adrian,

              The Moz reports are meant to help you uncover issues like this. If you're seeing non-canonical URLs in the Moz report then there is a potential issue for Google, Bing and other search engines as well.

              Google does respect wildcards (*) in the robots.txt file, though it can easily be done wrong. There is not right or wrong answer to the issue of using filters or faceted navigation, as each circumstance is going to be different. However, I hope some of these articles will help you identify the best approach for your needs:

              (Note: Faceted Navigation is not exactly the same as category filters, but the issues and possible solutions are very similar

              )Building Faceted Navigation That Doesn't Suck Faceted Navigation Whiteboard Friday
              Duplicate Content: Block, Redirect or Canonical
              Guide to eCommerce Facets, Filters and Categories
              Rel Canonical How To and Why Not
              Moz.com Guide to Duplicate Content

              I don't know how your store handles these (e.g. does it add the filter automatically, or only when a user selects a filter?) so I can't give you the answer, but I promise if you read those articles above you will have a very good understanding of all of the options so you can choose which is best for you. That might end up being as simple as blocking the filters in your robots.txt file, or you may opt for rel canonical, noindex meta tag, ajax, Google parameter handling, etc...

              Good luck!

              neenor 1 Reply Last reply Reply Quote 0
              • neenor
                neenor @Everett last edited by

                There certainly is a right answer to my question - I already posted it here earlier today:

                Disallow: /*?color=
                 Disallow: /
                ?*manufacturer=

                Without the $ at the end which would otherwise denote the end of the URL.

                Everett 1 Reply Last reply Reply Quote -1
                • Everett
                  Everett @neenor last edited by

                  Adrian,

                  I agree that there certainly is a right answer to the question posted, as the question asks specifically about one way to manage the issue, being a block of filters in the robots.txt file. What I was getting at is that this may or may not necessarily be the "best" way, and that I'd need to look at your site and your unique situation to figure our which would be the best solution for your needs.

                  It is very likely that with these parameters a robots.txt file block is the best approach, assuming the parameters aren't added by default into category page or category pagination page navigational links, as then it would affect the bot's ability to crawl the site. Also, if people are linking to those URLs (highly unlikely though) you may consider a robots meta noindex,follow tag instead so the pagerank could flow to other pages.

                  And I'm not entirely sure the code you provided above will work if the blocked parameter is the first one in the string (e.g. domain.com/category/?color=red) as there is the additional wildcard between the ? and the parameter. I would advise testing this in Google Webmaster Tools first.

                  1. On the Webmaster Tools Home page, click the site you want.
                  2. Under Crawl, click Blocked URLs.
                  3. If it's not already selected, click the Test robots.txt tab.
                  4. Copy the content of your robots.txt file, and paste it into the first box.
                  5. In the URLs box, list the site to test against.
                  6. In the User-agents list, select the user-agents you want (e.g. Googlebot)
                  1 Reply Last reply Reply Quote 0
                  • swissmadesmt
                    swissmadesmt last edited by

                    Yes, but what about bing and rest of Search Engine?

                    Everett 1 Reply Last reply Reply Quote 0
                    • Everett
                      Everett @swissmadesmt last edited by

                      Unless you're specifically calling out Bing or Baidu... in your Robots.txt file they should follow the same directives as Google so testing with Google's Robots.txt file tester should suffice for all of them.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      • Correct robots.txt for WordPress
                        jasongmcmahon
                        jasongmcmahon
                        1
                        5
                        180

                      • Can Robots.txt on Root Domain override a Robots.txt on a Sub Domain?
                        RyanPurkey
                        RyanPurkey
                        0
                        3
                        522

                      • Question about robots.txt
                        spencerhjustice
                        spencerhjustice
                        0
                        3
                        125

                      • When You Add a Robots.txt file to a website to block certain URLs, do they disappear from Google's index?
                        Saijo.George
                        Saijo.George
                        0
                        3
                        205

                      • New CMS system - 100,000 old urls - use robots.txt to block?
                        Blenny
                        Blenny
                        0
                        8
                        745

                      • Search engine friendly URLs
                        ebenthurston
                        ebenthurston
                        0
                        6
                        530

                      • Robots.txt file
                        Greenman
                        Greenman
                        0
                        3
                        652

                      • Photogallery and Robots.txt
                        Rapturecamps
                        Rapturecamps
                        0
                        5
                        831

                      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