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. How to avoid a redirect chain?

    How to avoid a redirect chain?

    Technical SEO Issues
    5 4 2.4k
    • 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.
    • netzkern_AG
      netzkern_AG last edited by

      Hi there,

      I am aware that it is not good practice to have a redirect chain but I am not really sure hoe to do it (on Apache).

      I have multiple redirects in a chain because on the one hand I had to redirect because the content of the site got a new URL and because on the other hand I changed from http to https. Thus I have a chain like

      http://example.com via 301 to http://the-best-example.com via 301 to https://the-best-example.com via 301 to https://greatest-example.com

      Obviously I want to clean this up without loosing any link juice or visitors who had bookmarked my site. So, I could make three separate redirects:

      http://example.com via 301 to https://greatest-example.com
      http://the-best-example.com via 301 to https://greatest-example.com
      https://the-best-example.com via 301 to https://greatest-example.com

      But is there a way to combine it? Can I use an "OR" operator to link the 3 conditions to this one rule?

      Any other suggestions?

      Thanks a lot!!!

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

        Hi,

        In a situation like this I would use something similar to:

        RewriteEngine on
        RewriteCond %{REMOTE_HOST} !^.+.example.com$ [OR]
        RewriteCond %{REMOTE_HOST} !^.+.the-best-example.com$
        RewriteRule ^(/~.+) https://greatest-example.com/$1 [R,L]

        (Sorry this was written off the top of my head, so give it a test before rolling it out!)

        Kind Regards

        Jimmy

        netzkern_AG 1 Reply Last reply Reply Quote 1
        • netzkern_AG
          netzkern_AG @DSM_UK last edited by

          yeah, thanks. That helps.

          PatrickDelehanty 1 Reply Last reply Reply Quote 0
          • PatrickDelehanty
            PatrickDelehanty @netzkern_AG last edited by

            Hey there

            I would also make sure that your sitemap and internal links are up to date so that there are no redirects happening in those places. You may also want to make sure you take the time to update listings and do a quick backlink audit to see if there are links you wish to update or possibly remove.

            Hope this helps as well - good luck!

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

              this is simple. rather that test what the domain name is, test what it is not.

              use the logic,

              if not my-preferred-domainname then redirect to my-preferred-domainname.

              1 Reply Last reply Reply Quote 1
              • 1 / 1
              • First post
                Last post
              • Redirect chain error free htaccess code for website
                0
                1
                34

              • Redirect chain being flagged in Moz
                GastonRiera
                GastonRiera
                0
                4
                38

              • Avoid landing page redirects
                Keszi
                Keszi
                0
                6
                175

              • Redirect Chain Domain
                Ian_Lewis
                Ian_Lewis
                0
                4
                668

              • Redirect chains after a site migration
                Dan-Lawrence
                Dan-Lawrence
                0
                3
                176

              • Redirect a 301 Redirect
                RedCaffeine
                RedCaffeine
                0
                5
                98

              • Static site to wordpress - avoiding 301 redirects
                OlegKorneitchouk
                OlegKorneitchouk
                0
                9
                423

              • Redirect or not to redirect
                AlanMosley
                AlanMosley
                0
                7
                458

              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