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. Partial Match or RegEx in Search Console's URL Parameters Tool?

    Partial Match or RegEx in Search Console's URL Parameters Tool?

    Intermediate & Advanced SEO
    15 4 1.5k
    • 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.
    • Ria_
      Ria_ @Martijn_Scheijbeler last edited by

      Hi Martijn, thanks for your response!

      I'm currently looking at something like this...

      **user-agent: *** #disallowing page.php and any parameters after it
      disallow: /page.php #but leaving anything that starts with par1=ABC
      allow: /page.php?par1=ABC

      I would have thought that you could disallow things broadly like that and give an exception, as you can with files in disallowed folders. But it's not passing Google's robots.txt Tester.

      One thing that's probably worth mentioning really is that there are only two variables that I want to allow of the par1 parameter. For example's sake, ABC123 and ABC456. So would need to be either a partial match or "this or that" kinda deal, disallowing everything else.

      Andy.Drinkwater Martijn_Scheijbeler 2 Replies Last reply Reply Quote 0
      • Andy.Drinkwater
        Andy.Drinkwater @Ria_ last edited by

        Sorry Martijn, just to jump in here for a second - Ria, you can test this via the Robots.txt testing tool in search console before going live to make sure it work.

        -Andy

        Ria_ 1 Reply Last reply Reply Quote 0
        • Martijn_Scheijbeler
          Martijn_Scheijbeler @Ria_ last edited by

          My guess would be that this line needs an * at the end.
          Allow: /page.php?par1=ABC*

          Ria_ 1 Reply Last reply Reply Quote 0
          • Ria_
            Ria_ @Andy.Drinkwater last edited by

            Hi Andy,

            Disallowing them would be my first priority really, before removing from index. Didn't want to remove them before I've blocked Google from crawling them in case they get added back again next time Google comes a-crawling, as has happened before when I've simply removed a URL here and there. Does that make sense or am I getting myself mixed up here?

            My other hack of a solution would be to check the URL in the page.php, and if URL includes par1=ABC then insert noindex meta tag. (Not sure if that would work well or not...)

            Andy.Drinkwater 1 Reply Last reply Reply Quote 0
            • Ria_
              Ria_ @Martijn_Scheijbeler last edited by

              I thought so too, but according to Google the trailing wildcard is completely unnecessary, and only needs to be used mid-URL.

              1 Reply Last reply Reply Quote 0
              • Ria_
                Ria_ @Andy.Drinkwater last edited by

                Yep, have done. (Briefly mentioned in my previous response.) Doesn't pass 😞

                Andy.Drinkwater 1 Reply Last reply Reply Quote 0
                • Andy.Drinkwater
                  Andy.Drinkwater @Ria_ last edited by

                  Disallowing them would be my first priority really, before removing from index.

                  The trouble with this is that if you disallow first, Google won't be able to crawl the page to act on the noindex. If you add a noindex flag, Google won't index them the next time it comes-a-crawling and then you will be good to disallow 🙂

                  I'm not actually sure of the best way for you to get the noindex in to the page header of those pages though.

                  -Andy

                  Ria_ 1 Reply Last reply Reply Quote 0
                  • Andy.Drinkwater
                    Andy.Drinkwater @Ria_ last edited by

                    Ah sorry I missed that bit!

                    -Andy

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

                      Don't forget that . & ? have a specific meaning within regex - if you want to use them for pattern matching you will have to escape them. Also be aware that not all bots are capable of interpreting regex in robots.txt - you might want to be more explicit on the user agent - only using regex for Google bot.

                      User-agent: Googlebot

                      #disallowing page.php and any parameters after it

                      disallow: /page.php

                      #but leaving anything that starts with par1=ABC

                      allow: page.php?par1=ABC

                      Dirk

                      Ria_ 1 Reply Last reply Reply Quote 1
                      • Ria_
                        Ria_ @Andy.Drinkwater last edited by

                        Haha, I think the train passed the station on that one. I would have realised eventually... XD

                        Thanks for your help!

                        Andy.Drinkwater 1 Reply Last reply Reply Quote 1
                        • Ria_
                          Ria_ @DirkC last edited by

                          Thank you! 😄

                          1 Reply Last reply Reply Quote 0
                          • Andy.Drinkwater
                            Andy.Drinkwater @Ria_ last edited by

                            No problem 🙂

                            Hope you get it sorted!

                            -Andy

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            • Will disallowing URL's in the robots.txt file stop those URL's being indexed by Google
                              Martijn_Scheijbeler
                              Martijn_Scheijbeler
                              0
                              11
                              1.6k

                            • URL Parameters Settings in WMT/Search Console
                              Martijn_Scheijbeler
                              Martijn_Scheijbeler
                              0
                              2
                              921

                            • Some site's links look different on google search. For example Games.com › Flash games › Decoration games How can we do our url's like this?
                              davebuts
                              davebuts
                              0
                              4
                              268

                            • How should I handle URL's created by an internal search engine?
                              CleverPhD
                              CleverPhD
                              0
                              4
                              416

                            • What to do when all products are one of a kind WYSIWYG and url's are continuously changing. Lots of 404's
                              evolvingSEO
                              evolvingSEO
                              0
                              6
                              201

                            • Should we use URL parameters or plain URL's=
                              PinpointDesigns
                              PinpointDesigns
                              0
                              5
                              207

                            • Tool that can retrieve mysite URL's
                              Vahe.Arabian
                              Vahe.Arabian
                              0
                              6
                              117

                            • Posing QU's on Google Variables "aclk", "gclid" "cd", "/aclk" "/search", "/url" etc
                              0
                              1
                              2.3k

                            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

                            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