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

            • Massive URL blockage by robots.txt
              CleverPhD
              CleverPhD
              0
              4
              160

            • Blocking out specific URLs with robots.txt
              Modi
              Modi
              0
              3
              133

            • Google: How to See URLs Blocked by Robots?
              ThompsonPaul
              ThompsonPaul
              0
              7
              6.0k

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

            • Will blocking urls in robots.txt void out any backlink benefits? - I'll explain...
              AubieJon
              AubieJon
              0
              4
              1.0k

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

            • Should we block urls like this - domainname/shop/leather-chairs.html?brand=244&cat=16&dir=ascℴ=price&price=1 within the robots.txt?
              sferrino
              sferrino
              0
              2
              864

            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