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. Blog subdomain not redirecting

    Blog subdomain not redirecting

    Intermediate & Advanced SEO
    25 4 1.2k
    • 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.
    • LesleyPaone
      LesleyPaone @MarkWill last edited by

      You are going to have to add a manual rewrite rule to the htaccess, preferably at the top. This might help, http://stackoverflow.com/questions/1321123/redirect-from-subdomain-to-domain-htaccess  But like Travis said, be careful, make a back up, because you can break your site doing this.

      1 Reply Last reply Reply Quote 1
      • MarkWill
        MarkWill @Travis_Bailey last edited by

        We are using the Redirection plugin.

        https://wordpress.org/plugins/redirection/

        However, everything I have entered is at the page level (redirect page1 to page2). I don't know if the Redirection plugin even supports subdomain redirection. I am checking that now (a quick scan of the support page for that plugin finds every question related to subdomains unanswered :)).

        It seems the working assumption is that nothing changed and that Moz/Google just found this for the first time, which I hadn't considered.

        Thanks.

        Mark

        Travis_Bailey 1 Reply Last reply Reply Quote 0
        • Travis_Bailey
          Travis_Bailey @MarkWill last edited by

          Okay, here's what I got:

          The plugin supposedly operates independently of .htaccess. So taking that at face value, I don't think you're going to get what you need out of the plugin.

          I would imagine the .htaccess file is much the same as it was when the site launched, or when it was last modified by the developer. So that file is likely going to need editing to achieve what you need. However, that file isn't something you just want to play with in a live environment.

          And it's not something anyone in their right mind would blindly say; "Yeah just copy and paste this rule!"

          I would talk to Dale and see if he has a block of free time coming up.

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

            Test that non-www 301's to www
            Make sure that all your internal links point to www, you don't want links that you control going thought a redirect.

            If those 2 are ok, then forget the report it will sort itself out over time.

            Travis_Bailey MarkWill 2 Replies Last reply Reply Quote 0
            • Travis_Bailey
              Travis_Bailey @AlanMosley last edited by

              This particular situation won't sort itself out. There's a sub involved and I suspect it's a rewrite rule that shouldn't be there. The developer appears to be somewhat sophisticated as they're using X-FRAME-OPTIONS in a way that doesn't allow iFrames to work outside of the domain.

              So who knows what goodies await in .htaccess. 😉

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

                Thanks Alan. I would like to verify one aspect of this.

                Somehow, Moz/Google located the blog.<domain>.com pages. I honestly don't know why but I assume that if these pages have actual resolved all along, as they do now, then I could potentially have external URLs pointing to them, yes? If so, then if I just follow the suggestion you have made then won't I continue to have duplicate content issues? I fear I am missing something from your suggestion :)</domain>

                PS: I just realized what you perhaps meant. I have generally seen references to "non-www" to mean URLs of the form http://<domain>.com</domain> ie. with no subdomain. But I am guessing you mean "non-www" in the broader sense - absolutely ANYTHING that doesn't have the www subdomain should redirect there. That's presumably what you had in mind, yes?

                Thanks again.

                Mark

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

                  Travis,

                  I want to be really sure I understand what you are saying so let me clarify.

                  I do have a blog DNS entry, referring to the server (just like I have www, to the same IP address).  In a "clean" installation, any page being requested to that server, SHOULD redirect to the www subdomain because I have www.<domain>.com</domain> specified in General \ Settings. Is that accurate so far?

                  However, "something" (probably in .htaccess) is kicking in that allows URLs with the blog subdomain to resolve (no redirection), regardless of what is in General \ Settings, yes?

                  Thanks.

                  Mark

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

                    Sorry missed the bit about blog.
                    obviously blog.domain.com should not 301 to www
                    it should point to the correct site, then all reports and google will sort themselves out.

                    so add one more step, test that blog does in fact resolve to the correct site

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

                      Thanks again, Alan.

                      I am thinking that what I probably need is to 301 redirect all URLs of the form http://blog.<domain>.com/page</domain> to http://www.<domain>.com/page</domain>, yes? In short I don't want to use the blog subdomain anywhere so, to avoid SEO inefficiencies, I should presumably redirect as above so that everything ends up at the www subdomain.

                      I think 🙂

                      Thanks.

                      Mark

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

                        Ok, I think I understand a bit better, you don't have a blog?
                        Then I would remove the dns record for blog, if you cant do that then yes you could 301 redirect

                        You can do this in one redirect following the logic
                        if not www.domain.com then redirect to www.domain.com

                        1 Reply Last reply Reply Quote 1
                        • MarkWill
                          MarkWill @Travis_Bailey last edited by

                          Here's the only (remotely) relevant entry I have in my .htaccess file (replacing my actual domain with <domain>):</domain>

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

                          The intent of this is to redirect all URLs of the form http://<domain>.com/page</domain> to http://www.<domain>.com/page.</domain> I implemented that a while back and it seems to be working just fine.

                          I can't find any reference to the blog subdomain. I suspect what I need to do is implement something like this:

                          RewriteCond %{HTTP_HOST} ^blog.<domain>.com$
                           RewriteRule (.*) http://www.<domain>.com/$1 [R=301,L]</domain></domain>

                          By the way, despite appearances I am "the guy" for this site. I've completely installed/configured it from scratch so anything broken is my fault 🙂 I have the smarts to backup, test, verify, restore etc so I can make changes to .htaccess myself. I just don't have significant experience of the .htaccess file itself so just need to be cautious as I go. But it's all me 🙂

                          Dare I suggest that what I am trying to achieve here (redirect from the blog subdomain to the www subdomain) shouldn't be too tricky?

                          Thanks.

                          Mark

                          AlanMosley Travis_Bailey 2 Replies Last reply Reply Quote 0
                          • AlanMosley
                            AlanMosley @MarkWill last edited by

                            in htaccess "!" means not so try this

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

                            also when using regex special chars like "." should be escaped with "" see above www.domain.com

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

                              The logic I used is like this.

                              rather than have a rules like
                              If wearing jeans, you must wear the school uniform
                              If wearing hoodie, you must wear the school uniform
                              If wearing a thong, you must wear the school uniform
                              If naked, you must wear the school uniform

                              you only need one rule
                              If not wearing school uniform, you must wear the school uniform

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

                                Yep, totally agree with the thinking and prefer that approach. I researched the non-www (blank subdomain) solution a while back and the rewrite rule I used was suggested in a number of places. But your suggest seems much more robust, providing there's no gotcha (I know of none).

                                I implemented this and it seems to be working (after a bit of a detour because of caching :)). So, I think I am good and will monitor.

                                A big thanks to you and Travis. I very much appreciate the prompt responses.

                                Mark

                                1 Reply Last reply Reply Quote 0
                                • Travis_Bailey
                                  Travis_Bailey @MarkWill last edited by

                                  I'm hesitant to say; "Do X." because I'm not really sure what will happen - with the redirect plugin in the mix. I imagine a lot, if not all of the subdomain folders and pages have already been redirected via the plugin. So I imagine the path of least disaster at the moment is just redirecting the subdomain (sub.domain.com) to the main domain (www.domain.com) alone.

                                  I could be totally wrong, but this one is weird.

                                  Test out the rule and then push live. Here is the code to redirect just the subdomain to just the www domain:

                                  RewriteCond %{HTTP_HOST} ^blog.domain.com$ [NC]
                                  RewriteCond %{REQUEST_URI} ^/?$
                                  RewriteRule .* http://www.domain.com [R=301,L]

                                  Double check it, triple check it and then push live. Keep a very close eye on it. I really hope we don't end up with a loop.

                                  AlanMosley Travis_Bailey 2 Replies Last reply Reply Quote 0
                                  • AlanMosley
                                    AlanMosley @Travis_Bailey last edited by

                                    Take a copy of the htaccess file, if something goes wrong, then you can always go back

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

                                      Looks like that, or some approximation thereof has you sorted. I would just like to add that you should keep an eye on Webmaster Tools.

                                      MarkWill 1 Reply Last reply Reply Quote 0
                                      • MarkWill
                                        MarkWill @Travis_Bailey last edited by

                                        So far so good - every URL I try to my site is now redirected to the www subdomain and, to date, I am unaware of any side effects. I will keep monitoring but all looks good at this point.

                                        Thanks again to everyone who helped with this.

                                        Mark

                                        1 Reply Last reply Reply Quote 0
                                        • 1
                                        • 2
                                        • 1 / 2
                                        • First post
                                          Last post
                                        • 301 Redirecting from domain to subdomain
                                          Chris8198
                                          Chris8198
                                          0
                                          3
                                          217

                                        • Redirecting main www. subdomain to new domain. Can you then create a new subdomain on the old domain?
                                          RobertFisher
                                          RobertFisher
                                          0
                                          6
                                          370

                                        • We are switching our CMS local pages from a subdomain approach to a subfolder approach. What's the best way to handle this? Should we redirect every local subdomain page to its new subfolder page?
                                          Ray-pp
                                          Ray-pp
                                          0
                                          4
                                          123

                                        • Redirecting external blog to main website blog - two questions I'm struggling with
                                          JaneCopland
                                          JaneCopland
                                          1
                                          6
                                          110

                                        • Subdomain blog vs. subfolder blog in 2013
                                          ABK717
                                          ABK717
                                          0
                                          9
                                          1.8k

                                        • Redirecting a redirect - thoughts?
                                          MikeRoberts
                                          MikeRoberts
                                          0
                                          2
                                          165

                                        • Redirect posts from a wordpress.com blog over to a self-hosted blog
                                          blacey
                                          blacey
                                          0
                                          7
                                          4.5k

                                        • Subdomains and SEO - Should we redirect to subfolder?
                                          AndyMacLean
                                          AndyMacLean
                                          0
                                          6
                                          2.5k

                                        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