Skip to content
    Moz logo Menu open Menu close
    • Products
      • Moz Pro
      • Moz Pro Home
      • Moz Local
      • Moz Local Home
      • STAT
      • Moz API
      • Moz API Home
      • Compare SEO Products
      • Moz Data
    • Free SEO Tools
      • Domain Analysis
      • Keyword Explorer
      • Link Explorer
      • Competitive Research
      • MozBar
      • More Free SEO Tools
    • Learn SEO
      • Beginner's Guide to SEO
      • SEO Learning Center
      • Moz Academy
      • SEO Q&A
      • Webinars, Whitepapers, & Guides
    • Blog
    • Why Moz
      • Agency Solutions
      • Enterprise Solutions
      • Small Business Solutions
      • Case Studies
      • The Moz Story
      • New Releases
    • Log in
    • Log out
    • Products
      • Moz Pro

        Your all-in-one suite of SEO essentials.

      • Moz Local

        Raise your local SEO visibility with complete local SEO management.

      • STAT

        SERP tracking and analytics for enterprise SEO experts.

      • Moz API

        Power your SEO with our index of over 44 trillion links.

      • Compare SEO Products

        See which Moz SEO solution best meets your business needs.

      • Moz Data

        Power your SEO strategy & AI models with custom data solutions.

      NEW Keyword Suggestions by Topic
      Moz Pro

      NEW Keyword Suggestions by Topic

      Learn more
    • Free SEO Tools
      • Domain Analysis

        Get top competitive SEO metrics like DA, top pages and more.

      • Keyword Explorer

        Find traffic-driving keywords with our 1.25 billion+ keyword index.

      • Link Explorer

        Explore over 40 trillion links for powerful backlink data.

      • Competitive Research

        Uncover valuable insights on your organic search competitors.

      • MozBar

        See top SEO metrics for free as you browse the web.

      • More Free SEO Tools

        Explore all the free SEO tools Moz has to offer.

      What is your Brand Authority?
      Moz

      What is your Brand Authority?

      Check yours now
    • Learn SEO
      • Beginner's Guide to SEO

        The #1 most popular introduction to SEO, trusted by millions.

      • SEO Learning Center

        Broaden your knowledge with SEO resources for all skill levels.

      • On-Demand Webinars

        Learn modern SEO best practices from industry experts.

      • How-To Guides

        Step-by-step guides to search success from the authority on SEO.

      • Moz Academy

        Upskill and get certified with on-demand courses & certifications.

      • SEO Q&A

        Insights & discussions from an SEO community of 500,000+.

      Unlock flexible pricing & new endpoints
      Moz API

      Unlock flexible pricing & new endpoints

      Find your plan
    • Blog
    • Why Moz
      • Small Business Solutions

        Uncover insights to make smarter marketing decisions in less time.

      • Agency Solutions

        Earn & keep valuable clients with unparalleled data & insights.

      • Enterprise Solutions

        Gain a competitive edge in the ever-changing world of search.

      • The Moz Story

        Moz was the first & remains the most trusted SEO company.

      • Case Studies

        Explore how Moz drives ROI with a proven track record of success.

      • New Releases

        Get the scoop on the latest and greatest from Moz.

      Surface actionable competitive intel
      New Feature

      Surface actionable competitive intel

      Learn More
    • Log in
      • Moz Pro
      • Moz Local
      • Moz Local Dashboard
      • Moz API
      • Moz API Dashboard
      • Moz Academy
    • Avatar
      • Moz Home
      • Notifications
      • Account & Billing
      • Manage Users
      • Community Profile
      • My Q&A
      • My Videos
      • Log Out

    The Moz Q&A Forum

    • Forum
    • Questions
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. Home
    2. SEO Tactics
    3. Technical SEO
    4. How to move my blog from subdomain to subfolder?

    Moz Q&A is closed.

    After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

    How to move my blog from subdomain to subfolder?

    Technical SEO
    7
    10
    7815
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with question 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
      • 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
        • KeriMorgret
          KeriMorgret 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
          • 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
            • 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
              • 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
                • 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
                  • 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
                    • 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 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
                        • 1 / 1
                        • First post
                          Last post

                        Got a burning SEO question?

                        Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                        Start my free trial


                        Browse Questions

                        Explore more categories

                        • Moz Tools

                          Chat with the community about the Moz tools.

                        • SEO Tactics

                          Discuss the SEO process with fellow marketers

                        • Community

                          Discuss industry events, jobs, and news!

                        • Digital Marketing

                          Chat about tactics outside of SEO

                        • Research & Trends

                          Dive into research and trends in the search industry.

                        • Support

                          Connect on product support and feature requests.

                        • See all categories

                        Related Questions

                        • Happy-SEO

                          Images, CSS and Javascript on subdomain or external website

                          Hi guy's, I came across webshops that put images, CSS and Javascript on different websites or subdomains. Does this boost SEO results? On our Wordpress webshop all the sourcescodes are placed after our own domainname: www.ourdomainname.com/wp-includes/js/jquery/jquery.js?ver=1.11.3'
                          www.ourdomainname.com/wp-content/uploads/2015/09/example.jpg Examples of other website: Website 1:
                          https://www.zalando.nl/heren-home/ Sourcecode:
                          https://secure-i3.ztat.net//camp/03/d5/1a0168ac81f2ffb010803d108221.jpg
                          https://secure-media.ztat.net/media/cms/adproduct/ad-product.min.css?_=1447764579000 Website 2:
                          https://www.bol.com/nl/index.html Sourcecode:
                          https://s.s-bol.com/nl/static/css/main/webselfservice.1358897755.css
                          //s.s-bol.com/nl/upload/images/logos/bol-logo-500500.jpg Website 3: 
                          http://www.wehkamp.nl/ Sourcecode:
                          https://static.wehkamp.nl/assets/styles/themes/wehkamp.color.min.css?v=f47bf1
                          http://assets.wehkamp.com/i/wehkamp/350-450-layer-SDD-wk51-v3.jpg

                          Technical SEO | | Happy-SEO
                          0
                        • Rezza

                          Migrating to new subdomain with new site and new content.

                          Our marketing department has decided that a new site with new content is needed to launch new products and support our existing ones. We cannot use the same subdomain(www = old subdomain  and ww1 = new subdomain)as there is a technically clash between the windows server currently used, and the lamp stack required to run the new wordpress based CMS and site. We also have an aging piece of SAAS software on the www domain which is makes moving it to it's own subdomain far too risky. 301's have been floated as a way of managing the transition. I'm not too keen on that idea due to the double effect of new subdomain and content, and the SEO impact it might have. I've suggested uploading the new site to the new subdomain while leaving the old site in place. Then gradually migrating sections over before turning parts of the old site off and using a 301 at that point to finalise the move. The old site would inform user's there is a new version and it would then convert them to the new site(along with a cookie to auto redirect them in future.) while still leaving the old content in place for existing search traffic, bookmarks and visitors via static URLs. Before turning off sections on the old site we would create rel canonicals to redirect to the new pages based on a a mapped set of URLs(this in itself concerns me as the rel canonical is essentially linking to different content). Would be grateful for any advice on whether this strategy is flawed or whether another strategy might be more suitable?

                          Technical SEO | | Rezza
                          0
                        • Gordian

                          Speed benefits from loading images from a subdomain

                          I have read that loading images from a subdomain of your site instead of the main domain will give you speed benefits on load time. Has anyone actually seen that to be the case? Thanks!

                          Technical SEO | | Gordian
                          0
                        • Prospector-Plastics

                          Subdomain vs Main Domain Penalties

                          We have a client who's main root.com domain is currently penalized by Google, but the subdomain.root.com is appearing very well. We're stumped - any ideas why?

                          Technical SEO | | Prospector-Plastics
                          0
                        • aactive

                          Simple 301 redirect a subfolder to another subfolder

                          Hi, I have a number of sub-folders that I have to move, each of which contains a number of files. subfolder A has files a, b & c subfolder B has files d, e & f
                          subfolder C has files g, h & i A, B & C folders need to be X, Y & Z Will the following work? RewriteRule ^subfolder-A/* http://www.domain.com/subfolder-X/ [R=301,L]
                          RewriteRule ^subfolder-B/* http://www.domain.com/subfolder-Y/ [R=301,L]
                          RewriteRule ^subfolder-C/* http://www.domain.com/subfolder-Z/ [R=301,L] will this result in visitors to http://www.domain.com/subfolder-B/f.html being redirected to http://www.domain.com/subfolder-Y/f.html? All on the same domain. in reality we are talking hundreds of sub folders and thousands of files so we don't want to have to reference every file individually in the htaccess. Thanks

                          Technical SEO | | aactive
                          0
                        • rahulchowdhury

                          Unnecessary pages getting indexed in Google for my blog

                          I have a blog dapazze.com and I am suffering from a problem for a long time. I found out that Google have indexed hundreds of replytocom links and images attachment pages for my blog. I had to remove these pages manually using the URL removal tool. I had used "Disallow: ?replytocom" in my robots.txt, but Google disobeyed it. After that, I removed the parameter from my blog completely using the SEO by Yoast plugin. But now I see that Google has again started indexing these links even after they are not present in my blog (I use #comment). Google have also indexed many of my admin and plugin pages, whereas they are disallowed in my robots.txt file. Have a look at my robots.txt file here: http://dapazze.com/robots.txt Please help me out to solve this problem permanently?

                          Technical SEO | | rahulchowdhury
                          0
                        • RocketZando

                          Best Way To Clean Up Unruly SubDomain?

                          Hi, I have several subdomains that present no real SEO value, but are being indexed. They don't earn any backlinks either. What's the best way of cleaning them up? I was thinking the following: 1. Verify them all in Webmaster Tools. 2. Remove all URLs from the index via the Removal Tool in WMT 3. Add site-wide no-index, follow directive. Also, to remove the URLs in WMT, you usually have to block the URLs via /robots.txt. If I'd like to keep Google crawling through the subdomains and remove their URLs, is there a way to do so?

                          Technical SEO | | RocketZando
                          0
                        • vernonmack

                          Blogs are best when hosted on domain, subdomain, or...?

                          I’ve heard the it is a best practice to host your blog within your site. I’ve also heard it’s best to put it on a subdomain.  What do you believe is the best home for your blog and why?

                          Technical SEO | | vernonmack
                          0

                        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
                        Free SEO Tools
                        • Domain Authority Checker
                        • Link Explorer
                        • Keyword Explorer
                        • Competitive Research
                        • Brand Authority 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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                        • Accessibility
                        • Terms of Use
                        • Privacy

                        Looks like your connection to Moz was lost, please wait while we try to reconnect.