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. How to 301 redirect all URLs with /? in?

    How to 301 redirect all URLs with /? in?

    Intermediate & Advanced SEO
    9 2 331
    • 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.
    • JohnPeters
      JohnPeters last edited by

      I want to redirect all URLs that have /? in it.

      Indexed in Google is a bunch of urls lik:

      mysite.com/?674764

      mysite.com/?rtf8y78

      I want all these URLs to be redirected to my home page.

      Any ideas?

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

        It depends on the type of system you used to create your website. Speak to your developers and they can create a rule in your htaccess file that will redirect all urls with /?.

        Before you do that  you need to establish why you want to redirect them and how those urls were created in the first place. understanding how they came about might unearth a cms related issue which can be better address with canonical, webmaster tools url paremeters or other techniques of avoiding duplicate content.

        JohnPeters 1 Reply Last reply Reply Quote 0
        • JohnPeters
          JohnPeters @DukeTanson last edited by

          The URLs have been indexed by Google from an old site.

          The new site is now a Wordpress site.

          To tidy up what Google has indexed I want to redirect these /? URLs to the home page.

          I have tried the "link juice keeper" plugin but that did not work.

          I really need to know what code I need to put in the htaccess file to do this. i have tried a whole bunch of things but cant get it to work

          DukeTanson JohnPeters 6 Replies Last reply Reply Quote 0
          • DukeTanson
            DukeTanson @JohnPeters last edited by

            Are these urls currently leading to a 404 page? if they are then  follow these steps

            1. Download the list from Google webmaster tools, use "text to columns" in excel to break the url up so you have "/?xxxx" in one column.
            2. Install http://wordpress.org/extend/plugins/wordpress-seo/ and go through all the right setup
            3. click on "edit files" submenu and add this rule Redirect 301  /?xxxx   http://www.homepage.com (where /?xxx is the url you want to redirect and "hompage" is the correct url of your homepage.

            Hope this helps

            1 Reply Last reply Reply Quote 0
            • JohnPeters
              JohnPeters @JohnPeters last edited by

              No the URLs just show the home page and not a 404

              There are hundreds of them, so would  it not be easier to make a 301 rule in the htaccess that redirects all urls that have /? in, rather then manually redirecting each URL?

              1 Reply Last reply Reply Quote 0
              • DukeTanson
                DukeTanson @JohnPeters last edited by

                Ok. have a look at the page source and see what canonical is shows. if its pointing to  the current homepage then leave it for a while. Google will catch up with and remove it from the index. if not the post a full url here so i can take a look for you.

                1 Reply Last reply Reply Quote 0
                • JohnPeters
                  JohnPeters @JohnPeters last edited by

                  Hi Duke, appreciate your help.

                  The URLs such as mysite.com/?674764 dont have a page. When you visit the URL it just shows the home page.

                  Ive just looked at another Wordpress site and added this /? in the URL, again it shows the home page without redirecting the URL

                  See here: http://yoast.com/?

                  Infact you can enter anything after the /? and it will still show the home page

                  1 Reply Last reply Reply Quote 0
                  • DukeTanson
                    DukeTanson @JohnPeters last edited by

                    It looks like you might not have anything to worry about then. pick an example of that url with ?zxxxxx. look at the page source (in firefox, go to tools, web developer, then page source) look for "rel=canonical". if the url indicated there is your homepage then you have nothing to worry about. after a few crawls, Google will know that the url is the same as the home and will remove those urls from the index.

                    1 Reply Last reply Reply Quote 0
                    • JohnPeters
                      JohnPeters @JohnPeters last edited by

                      Just looked at the code and yes it does have rel=canonical

                      I had no idea that this would tell google its the same as the home page

                      Thanks for helping, really appreciate it.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      • Going from 302 redirect to 301 redirect weeks after changing URL structure
                        vcj
                        vcj
                        0
                        2
                        131

                      • I've got duplicate pages. For example, blog/page/2 is the same as author/admin/page/2\. Is this something I should just ignore, or should I create the author/admin/page2 and then 301 redirect?
                        BeanstalkIM
                        BeanstalkIM
                        0
                        5
                        414

                      • 301 redirect to a temporary URL
                        AlanMosley
                        AlanMosley
                        0
                        4
                        211

                      • Should /node/ URLs be 301 redirect to Clean URLs
                        MargaritaS
                        MargaritaS
                        0
                        3
                        172

                      • How to use a 301 Redirect when the first 301 Redirect is not the same as what's indexed?
                        PatriotOutfitters81
                        PatriotOutfitters81
                        0
                        3
                        66

                      • 301 Redirection and apostrophes in URLs
                        Seamoose
                        Seamoose
                        0
                        3
                        2.0k

                      • Help with setting up 301 redirects from /default.aspx to the "/" in ASP.NET using MasterPages?
                        BrianCrouch
                        BrianCrouch
                        0
                        2
                        595

                      • Probelms w/ 301 Redirects
                        Melia
                        Melia
                        0
                        3
                        552

                      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