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 Can I Redirect an Old Domain to Our New Domain in .htaccess?

    How Can I Redirect an Old Domain to Our New Domain in .htaccess?

    Intermediate & Advanced SEO
    4 2 3.6k
    • 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.
    • smpomoryCRH
      smpomoryCRH last edited by

      There is an old version of http://chesapeakeregional.com still floating around the web here: http://www.dev3.com.php53-24.dfw1-2.websitetestlink.com/component/content/category/20-our-services. Various iterations of this domain pop up when I do certain site:searches and for some queries as well (such as "Diagnostic Center of Chesapeake").

      About 3 months ago the websitetestlink site had files and a fully functional navigation but now it mostly returns 404 or 500 errors. I'd like to redirect the site to our newer site, but don't believe I can do that in chesapeakeregional.com's .htaccess file. Is that so and would I need access to the websitetestlink .htaccess to forward the domain?

      Note* I (nor anyone else in our organization) has the login for the old site. The new site went live about 9 months before I arrived at the organization and I've been slowly putting the pieces together since arriving.

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

        There are several resources around the net that show how to do this. Here's a code snippet provided by http://www.inmotionhosting.com/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess

        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
        RewriteCond %{HTTP_HOST} ^www.example.com [NC]
        RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]

        If this doesn't work for you, here are some other resources:
        https://www.internetmarketingninjas.com/blog/search-engine-optimization/301-redirects/
        https://css-tricks.com/snippets/htaccess/301-redirects/
        http://www.bruceclay.com/blog/how-to-properly-implement-a-301-redirect/

        The first code example is more canonical friendly. The simple version I see used a lot and recommended in the other resources I've provided looks like this:

        RedirectMatch 301 ^(.*)$ http://www.xyz.com
        
        
        smpomoryCRH 1 Reply Last reply Reply Quote 1
        • smpomoryCRH
          smpomoryCRH @brettmandoes last edited by

          Hi Brett,

          I've tried the above and previously found the InMotion Hosting resource. I'm able to redirect pages on chesapeakeregional.com just fine. I believe I cannot do the above in the ches reg .htacess because the site I want to redirect from is a different domain. If I could, there wouldn't be anything to stop anyone from redirecting, say facebook.com, to their own website...unless I'm misunderstanding something.

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

            Sorry Sean, I misunderstood your question. No, you cannot redirect any website you don't have access to. My recommendation would be to contact the host and work with them to obtain access. It's usually not a complex process.

            1 Reply Last reply Reply Quote 1
            • 1 / 1
            • First post
              Last post
            • 301 Old domain with HTTPS to new domain with HTTPS
              waqid
              waqid
              0
              3
              54

            • Domain Name redirection to new Domain Name - VS - Transfering Domaine Name from account 1 to account 2
              1
              1
              38

            • Should I revive the old domain or just redirect all the juicy links to my new site?
              Alick300
              Alick300
              0
              2
              61

            • Moving site to new domain without access to redirect from old to new. How can I do this with as little loss to SERP results as possible?
              c_estep_tcbguy
              c_estep_tcbguy
              0
              11
              83

            • Redirect two existing domains permanently to a brand new domain
              Townpages
              Townpages
              0
              6
              79

            • Is it worth redirecting an old domain name which was hacked to my new website?
              james.rose
              james.rose
              0
              5
              223

            • Is it safe to 301 redirect old domain to new domain after a manual unnatural links penalty?
              Ewan.Kennedy
              Ewan.Kennedy
              0
              13
              1.7k

            • Hit by Penguin, Can I move the content from the old site to a new domain and start again with the same content which is high quality
              warren007
              warren007
              1
              4
              446

            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