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. Code to redirect subdomain to root domain

    Code to redirect subdomain to root domain

    Technical SEO Issues
    5 2 971
    • 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.
    • Guest
      Guest last edited by

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • RyanKent
        RyanKent last edited by

        Are you on an apache server? If so, you need to add the proper regex expression to your htaccess file.

        I am not a htaccess expert. This code may not work and could cause interruption to your site. If you take this suggestion be sure to back up your .htaccess file and be prepared to switch files back immediately if it does not work.

        With the above understood, you can try adding the below code to your htaccess file:

        RewriteEngine On
        RewriteCond %{HTTP_HOST} ^products.indiabizone.com$
        RewriteRule (.*) http://www.indiabizone.com/$1 [R=301,L]

        Guest 1 Reply Last reply Reply Quote 0
        • Guest
          Guest @RyanKent last edited by

          This post is deleted!
          RyanKent Guest 2 Replies Last reply Reply Quote 0
          • RyanKent
            RyanKent @Guest last edited by

            You are most welcome. Please let me know if it works.

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

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • I have a question about the impact of a root domain redirect on site-wide redirects and slugs.
                Xiano
                Xiano
                0
                2
                72

              • HTACESS Redirect Root Domain To Sub-Directory
                LynnPatchett
                LynnPatchett
                0
                3
                151

              • I have a sub domain that has live content on it but the root domain redirects to another URL. I know this is not great but what are the implications?
                mjsikorsky
                mjsikorsky
                0
                3
                96

              • Why am I getting millions of links from my root domain to my subdomains?
                katemorris
                katemorris
                0
                6
                101

              • 301 Redirect & Linking Root Domain Count
                iAnalyst.com
                iAnalyst.com
                0
                2
                466

              • Can I do a redirect to a new domain name only a couple of weeks after having redirected to another domain?
                Francisco_Meza
                Francisco_Meza
                0
                4
                428

              • 301 Redirect Domain or 301 Redirect Domain + Interior Pages
                Room214
                Room214
                0
                7
                1.1k

              • Redirecting root domains to sub domains
                Yozzer
                Yozzer
                0
                4
                804

              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