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. Htaccess 301s to 3 different sites

    Htaccess 301s to 3 different sites

    Technical SEO Issues
    8 2 567
    • 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.
    • ellenru
      ellenru last edited by

      Hi,

      I'm an htaccess newbie, and I have to redirect and split traffic to three new domains from site A.

      The original home page has most of the inbound links so I've set up a 301 that goes to site B, the new corporate domain.

      Options +FollowSymLinks
      RewriteEngine on
      RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

      Brand websites C and D need 301s for their folders in site A but I have no idea how to write that in relationship to the first redirect, which really is about the home page, contact and only a few other pages.

      The urls are duplicates except for the new domain names. They're all on Linux..Site A is about 150 pages, should I write it by page, or can I do some kind of catch all (the first 301) plus the two folders?

      I'd really appreciate any insight you have and especially if you can show me how to write it.

      Thanks πŸ™‚

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

        Hi Ellen,

        If you only wanted to redirect all the url's in a certain subdirectory to the new site (not 1-on1), your redirect would look something like this:

        RedirectMatch 301 ^/subdirectory/$ http://www.websiteB.com/

        But... I dont think you want to do that πŸ™‚ (Or should do that...) I think you should want to redirect all pages in the subdirectory to their corresponding url on websiteB.

        What I mean by that is: you should redirect all your pages 1-on1, like this:

        Redirect: www.websiteA.com/subdirectory/url1.html to its equivalent on website B's url: www.websiteB.com/url1.html

        If you want to do that, you can. But the url's have to be the same. You can do something like:

        RedirectMatch 301 /subdirectory/(.*) http://www.websiteB.com/$1

        If the url's change, than you have to do more manual work. You should always try to redirect as many pages 1on1 as you can. Especially the ones that receive external links. The new pages will be almost as "juicy" as the old pages, because the 301 redirect passes the linkjuice along. (not all of it though, but like 90% - 99%)

        Is this pushing you a bit in the right direction? πŸ™‚

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

          Thanks Yannick πŸ™‚

          I'm tracking with you except I have to make the subfolders go not to site B, but new sites...C and D. So can I do it like this:

          RedirectMatch 301 /subdirectory/(.*) http://www.websiteC.com/$1

          and then

          RedirectMatch 301 /subdirectory/(.*) http://www.websiteD.com/$1

          The urls match. But the subfolder pages have very few links so I'm less concerned about link juice then just getting the indexing to avoid a bunch of 404s.

          The subdirectories on site A got split into 2 freestanding domains for "branding"....and have added a bunch of new pages that don't correspond to the old folder (though some do). They also moved from drupal to WP and I wonder if I need the old htaccess instructions for drupal ? We're keeping the old site in place for a while duringΒ  the migration.

          Thanks so much again for the reply πŸ™‚

          YannickVeys 1 Reply Last reply Reply Quote 0
          • YannickVeys
            YannickVeys @ellenru last edited by

            RedirectMatch 301 /subdirectoryA/(.*) http://www.websiteB.com/$1

            and

            RedirectMatch 301 /subdirectoryB/(.*) http://www.websiteC.com/$1

            Otherwise it wont work πŸ™‚

            About the htaccess from the old site... As long as Website A (the old site) is still up and the redirects on that site is properly set up in the htaccess on that server, I don't see any reason to also use it on the new sites.

            ellenru YannickVeys 4 Replies Last reply Reply Quote 1
            • ellenru
              ellenru @YannickVeys last edited by

              Greatness. Thanks!

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

                You're welcome! πŸ™‚ Hope everything works out! πŸ™‚

                Test a few URL's first. Or even better: setup a small test case to make sure it works!

                1 Reply Last reply Reply Quote 0
                • ellenru
                  ellenru @YannickVeys last edited by

                  Yannick, it worked like a charm to all three new sites. Great info, thank you for taking the time to help me out.

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

                    You are most welcome! Appreciate your feedback that it worked! πŸ™‚

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    • 1 multilingual site, 2 domains in different languages.
                      kwoolf
                      kwoolf
                      1
                      5
                      91

                    • We are migrating a site and are seeing alot of 301s and 302s already in the old site is it ok to leave those as is?
                      KristinaKledzik
                      KristinaKledzik
                      0
                      3
                      49

                    • Setting up a site with different extensions (.co.uk and .com)
                      donford
                      donford
                      0
                      2
                      147

                    • Off-site company blog linking to company site or blog incorporated into the company site?
                      TheKatzMeow
                      TheKatzMeow
                      0
                      6
                      113

                    • 3 Different Websites but Same Keywords
                      Jarvatar
                      Jarvatar
                      0
                      6
                      141

                    • Difference between www and non-www site
                      Cyrus-Shepard
                      Cyrus-Shepard
                      0
                      6
                      7.8k

                    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