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 move my blog from subdomain to subfolder?

    How to move my blog from subdomain to subfolder?

    Technical SEO Issues
    13 7 5.5k
    • 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.
    • MarloSchneider
      MarloSchneider last edited by

      Not an unusual situation, I have a blog on blog.domain.com it has quite a few blog postings.  The platform is old and will be scrapped, but the blog content itself is going to be moved to domain.com/blog.

      The current process is we are manually listing all linked to/content pages and we are going to 301 redirect them to their counterparts on the new blog.  This is going to be a tedious process.

      A) Is there any way to automate the moving of the blog?

      B) What is the best way to do the massive 301 redirect, php headers, .htaccess?  Should we move the individual pages with redirects, or redirect the domain in the .htaccess (this will be very difficult to match all the titles and file structure)?

      1 Reply Last reply Reply Quote 0
      • Getz.pro
        Getz.pro last edited by

        I am mobile, so excuse the typos 🙂 Using PHP, grab the incoming title and do a 301 header redirect to the new location. No need to mass 301 in .htaccess. 🙂 If you need the script, let me know

        MarloSchneider 1 Reply Last reply Reply Quote 0
        • Dan-Petrovic
          Dan-Petrovic last edited by

          Found this one:

          RewriteEngine On
          RewriteCond %{HTTP_HOST} ^blog.mysite.com
          RewriteRule ^(.*)$ /blog/$1 [L]

          Source: http://www.scriptygoddess.com/archives/2007/06/13/redirect-a-subdomain-to-a-directory-using-htaccess/

          Getz.pro 1 Reply Last reply Reply Quote 0
          • Getz.pro
            Getz.pro @Dan-Petrovic last edited by

            Yup, that will do the job of relocation, but it does not 301 the link and therefore you will not transfer link juice.

            A_Q 1 Reply Last reply Reply Quote 1
            • MarloSchneider
              MarloSchneider @Getz.pro last edited by

              Would you mind posting or messaging me the correct script?  It would be a great help, thanks.

              KeriMorgret MarloSchneider 2 Replies Last reply Reply Quote 0
              • KeriMorgret
                KeriMorgret @MarloSchneider last edited by

                Spencer, did you get this taken care of off-line, or is this question still open?

                [Keri Morgret, SEOmoz Associate]

                1 Reply Last reply Reply Quote 0
                • A_Q
                  A_Q @Getz.pro last edited by

                  It will if you add r=301 to the last line like so:

                  RewriteRule ^(.*)$ /blog/$1 [L,R=301]

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

                    We solved it, our web programmer wrote a program to scrape all of our posts and turn them into a format that imported into wordpress.  As far as the redirects we kept the page titles the same and did a sitewide 301 that sent them from blog.example.com to example.com/blog/

                    Although I would still like to grab Richard's php script for doing this in a more efficient manner in the future.

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

                      This post is deleted!
                      KeriMorgret 1 Reply Last reply Reply Quote -2
                      • KeriMorgret
                        KeriMorgret @jaraca last edited by

                        This thread is actually four years old, and the original poster mentioned that the problem was solved so no worries! You might want to look at more recent questions, as SEO advice can change as the search engines change.

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

                          Hi Keri.

                          You're right! I am not a professional in the matter and I am trying to catch up little by little.

                          Thanks for your advice!

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

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

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              • Subdomain or subfolder?
                                NickSamuel
                                NickSamuel
                                0
                                4
                                1.6k

                              • Moving a subdomain to subfolder with CNAME
                                0
                                1
                                39

                              • Is this a Risky Blog Move?
                                Caro-O
                                Caro-O
                                0
                                4
                                104

                              • I have consolidated my subdomains into subfolders; should i remove the subdomains also?
                                McCaldin
                                McCaldin
                                0
                                5
                                93

                              • Blog for a Prestashop: WP at subfolder or blog with dedicated keyword based domain?
                                sergio_redondo
                                sergio_redondo
                                0
                                3
                                1.0k

                              • Subdomain for a blog
                                Francisco_Meza
                                Francisco_Meza
                                0
                                6
                                391

                              • Moving subdomain ? How to ?
                                VasilTasev
                                VasilTasev
                                0
                                3
                                384

                              • Blog on a subdomain vs subfolder?
                                sportstvjobs
                                sportstvjobs
                                0
                                3
                                1.1k

                              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