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. Block session id URLs with robots.txt

    Block session id URLs with robots.txt

    Intermediate & Advanced SEO
    4 3 130
    • 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.
    • Mat_C
      Mat_C last edited by

      Hi,

      I would like to block all URLs with the parameter '?filter=' from being crawled by including them in the robots.txt.

      Which directive should I use:

      User-agent: *
      Disallow: ?filter=

      or

      User-agent: *
      Disallow: /?filter=

      In other words, is the forward slash in the beginning of the disallow directive necessary?

      Thanks!

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

        Hi,

        The following should suffice as it will black any URL with a "?" in it

        User-agent: *
        Disallow: /*?
        
        Martijn_Scheijbeler 1 Reply Last reply Reply Quote 0
        • Martijn_Scheijbeler
          Martijn_Scheijbeler @jasongmcmahon last edited by

          Uhh, that's not what the requester is looking for and could actually cause tons of problems if you would apply this on a site that you're unaware of. I would always go with the most limiting robots.txt that you can and in this case, I would go with: /?filter=

          Mat_C 1 Reply Last reply Reply Quote 1
          • Mat_C
            Mat_C @Martijn_Scheijbeler last edited by

            Hi Martijn,

            Thanks for the answer. Regarding the forward slash in the beginning, is it necessary to use this?

            In the robots text from Zalando for example, you can see that they don't use it for a lot of filters.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Block subdomain directory in robots.txt
              DirkC
              DirkC
              0
              5
              1.1k

            • Robots.txt Blocked Most Site URLs Because of Canonical
              0
              1
              117

            • Google showing high volume of URLs blocked by robots.txt in in index-should we be concerned?
              TakeshiYoung
              TakeshiYoung
              0
              4
              302

            • What should I block with a robots.txt file?
              Travis-W
              Travis-W
              1
              3
              298

            • What content should I block in wodpress with robots.txt?
              ENSO
              ENSO
              0
              4
              518

            • Search Engine Blocked by robots.txt for Dynamic URLs
              KeriMorgret
              KeriMorgret
              0
              2
              689

            • Block an entire subdomain with robots.txt?
              kylesuss
              kylesuss
              1
              16
              102.1k

            • Blocking Dynamic URLs with Robots.txt
              TaitLarson
              TaitLarson
              1
              4
              5.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