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. Technical SEO Issues
    4. 301 redirect

    301 redirect

    Technical SEO Issues
    27 4 1.9k
    • 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.
    • SimonCullum
      SimonCullum @sesertin last edited by

      Ok, as I'd like to help, just looking at your exact question then:

      Is it like this?

      RedirectMatch 301 ^thisword$ http://domain.com/newlocation
      

      My answer was:

      
      **RedirectMatch 301 /folder/filename.php http://www.domain.com/newlocation** 
      
      is probably what you're after anyway going by your example in your question.
      
      which seems to answer the question asked, just provided a lot more information to help further.
      
      If that's not what you're after, could you rephrase the question so that you can get the help you are after?
      
      Regards
      
      Simon
      
      ```
      1 Reply Last reply Reply Quote 0
      • ShaMenz
        ShaMenz last edited by

        Hi Zsolt,

        Just so we understand exactly what you are asking here ...

        What you are wanting to do is permanently redirect any and all URLs containing "thisword" to a single URL on the same domain? Is that accurate?

        Sha

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

          I'm looking for a method to redirect any urls containing a certain variable. I have  a scorable element on my site and each time a new score is added a new url is generated like domain.com/xyz?score=5 or domain.com/score=4&rew=22. These are all alternates of my main page abd I would like to redirect them there. In the end found something when clicking through from Jennifer's post but I'm still not quite sure.

          1 Reply Last reply Reply Quote 0
          • sesertin
            sesertin @ShaMenz last edited by

            You got it right

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

              I think it should be something like

              Redirectmatch 301 /.*thisword.``* http://domain.com

              Maybe but I am not sure, would be grateful for feedback

              ShaMenz 1 Reply Last reply Reply Quote 0
              • ShaMenz
                ShaMenz @sesertin last edited by

                Hi again,

                We set up an example page for you with working tests and links to example code and zipped version.

                Hope that is what you need,

                Sha

                sesertin 1 Reply Last reply Reply Quote 1
                • AlanMosley
                  AlanMosley last edited by

                  the ^ symbol means the begins with, the $ means ends with

                  so ^thisword$ means the URL must be a exact match "thisword"

                  try simply thisword

                  sesertin 1 Reply Last reply Reply Quote 0
                  • sesertin
                    sesertin @ShaMenz last edited by

                    Thank  you a lot for your help, very much appriciated

                    1 Reply Last reply Reply Quote 0
                    • sesertin
                      sesertin @AlanMosley last edited by

                      Thanks, Alan. Not really like that, as my url contains additional characters both in the front and at the end of the word. By the way the links you sent me on the topic were great I am just having some hard time to understand them, they are a bit chinese to me, as I have no basics at all writing htaccess.

                      AlanMosley sesertin ShaMenz 15 Replies Last reply Reply Quote 0
                      • AlanMosley
                        AlanMosley @sesertin last edited by

                        Did you try it, it works for me.

                        Just try simply thisword

                        it should match aaaathiswordaaaaa

                        this will work,

                        [a-z]thisword [a-z]

                        but so will

                        thisword

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

                          still not working for me.

                          The exact url is domain.com/?score=4&rew=25   (there are some more versions of course with different counters)

                          I want to redirect all urls like this to domain.com

                          tried:

                          RedirectMatch 301 /[a-z]score[a-z] http://domain.com
                          RedirectMatch 301 /.score. http://domain.com
                          RedirectMatch 301 /^score$.* http://domain.com
                          RedirectMatch 301 /.^score$.* http://domain.com

                          none of them woks

                          1 Reply Last reply Reply Quote 0
                          • AlanMosley
                            AlanMosley @sesertin last edited by

                            i work on microsoft servers, so i am not sure about the sytax of htaccess.

                            but the regex is the same.

                            please try these.

                            RedirectMatch 301 [a-z]score[a-z] http://domain.com
                            RedirectMatch 301 score http://domain.com

                            you missed the *

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

                              Still not working for me. I tried further with:

                              RedirectMatch 301 [.]score[.] http://domain.com  (I thought a-z stands just for letter and urls contain number and marks)
                              RedirectMatch 301 [.]score[.] http://domain.com

                              neither works

                              1 Reply Last reply Reply Quote 0
                              • AlanMosley
                                AlanMosley @sesertin last edited by

                                You are correct, give me a munite and ill get back to you

                                1 Reply Last reply Reply Quote 0
                                • AlanMosley
                                  AlanMosley @sesertin last edited by

                                  try [a-z,0-9]score[a-z,0-9]

                                  1 Reply Last reply Reply Quote 1
                                  • AlanMosley
                                    AlanMosley @sesertin last edited by

                                    [a-z,0-9,=,&]alan[a-z,0-9,=,&]

                                    get the idea

                                    1 Reply Last reply Reply Quote 1
                                    • AlanMosley
                                      AlanMosley @sesertin last edited by

                                      Here this will select your whole url

                                      [a-z,0-9,=&?/.]score[a-z,0-9,=&]

                                      1 Reply Last reply Reply Quote 1
                                      • sesertin
                                        sesertin @sesertin last edited by

                                        nothing works. maybe I'll try posting another thread.

                                        1 Reply Last reply Reply Quote -1
                                        • AlanMosley
                                          AlanMosley @sesertin last edited by

                                          Well that will select your url, but what are you trying to do with it.

                                          i have it working on IIS server using that regex, but i cant tell you how to use it in htaccess, as i dont use it

                                          1 Reply Last reply Reply Quote 1
                                          • sesertin
                                            sesertin @sesertin last edited by

                                            Thanks for the help. Regretfully this is my very first time writing htaccess so lot of faults can occur. I posted another thread maybe someone knows better than I do. Thank you very much for your time.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            • 301 Redirects Showing As 307 Redirects
                                              0
                                              1
                                              64

                                            • To 301 or not to 301?
                                              iHasco
                                              iHasco
                                              1
                                              4
                                              70

                                            • To 301 or not to 301?
                                              seorocket
                                              seorocket
                                              0
                                              3
                                              91

                                            • Redirect a 301 Redirect
                                              RedCaffeine
                                              RedCaffeine
                                              0
                                              5
                                              98

                                            • 301 redirect
                                              Mark.RedGiant
                                              Mark.RedGiant
                                              0
                                              3
                                              322

                                            • 301 Redirects
                                              trophycentraltrophiesandawards
                                              trophycentraltrophiesandawards
                                              1
                                              3
                                              426

                                            • Redirects 301
                                              PedroM
                                              PedroM
                                              0
                                              5
                                              639

                                            • 301 Redirects
                                              KT684
                                              KT684
                                              0
                                              5
                                              711

                                            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