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

                        • Dreamrealemedia

                          Move a Wordpress Site to HTTPS with Bluehost

                          HI Guys, do you think that the following guide is enoght to move a bluehost wordpress site to https in a seo best practive way? https://www.shoutmeloud.com/free-ssl-certificate-bluehost-hosting.html Basically their steps are: Install SSL on Bluehost panel Install Really Simple SSL Wp Plugin Edit Your .htacess File & Add The Code For HTTP To HTTPS Redirection Update All HTTP URLs In Database To HTTPS Using Search and Replace Plugin Use Broken Link Checker plugin & use its redirection module to find links to 3rd party sites with HTTP that should now be HTTPS. Last thing to do Submit your new HTTPS site to Google Search Console & submit your sitemap. Update your profile link on Google Analytics. Update your website links on social media profiles & anywhere else they exist. This step you can do in pieces in the coming days. Read this guide to learn more about HTTP to HTTPS migration & fixing mixed content. If you disabled Who.Is guard for your domain name, you can enable it now. Do you know a better practical guide for wordrpess? in term of usefull plugins to handle the migration? Tx to everyone!

                          Technical SEO | | Dreamrealemedia
                          0
                        • m.m

                          Subdomain as News Section instead of Source in Google News?

                          Hi, trying to dig into Google News for a large site, mostly containing news.
                          The structure of the site network is subdomain.domain.se, and each subdomain has it's own brand with it's own news: x.domain.se
                          y.domain.se
                          z.domain.se
                          etc... Each brand/subdomain is more or less to equate with its own subjectfield/section. In Google News every subdomain is configured with it's own Site Source url, but also having the set up with one section with the same url. It seems like they're getting conflicts in Google News, Google can't always figure out which news article to which brand. Example: an article owned by brand A, but it is sometimes happens that articles getting labeled as brand B in the news SERP, though the link takes you correctly to brand A. I am thinking that this config in News Publisher Center may be a problem? Anyone having any thoughts if that would be better if we delete all source urls except for domain.se-brand and then put all the other subdomains as sections? www.domain.se x.domain.se y.doamin.se z.domain.se Any smart thoughts on this one? Or anything else that could make this wrong labeling (all content included images are hosted in same domain for example). Regards,
                          Magnus

                          Technical SEO | | m.m
                          0
                        • Whittie

                          Robots.txt on subdomains

                          Hi guys! I keep reading conflicting information on this and it's left me a little unsure. Am I right in thinking that a website with a subdomain of shop.sitetitle.com will share the same robots.txt file as the root domain?

                          Technical SEO | | Whittie
                          0
                        • jamesm5i

                          "Fourth-level" subdomains. Any negative impact compared with regular "third-level" subdomains?

                          Hey moz New client has a site that uses: subdomains ("third-level" stuff like location.business.com) and; "fourth-level" subdomains (location.parent.business.com) Are these fourth-level addresses at risk of being treated differently than the other subdomains? Screaming Frog, for example, doesn't return these fourth-level addresses when doing a crawl for business.com except in the External tab. But maybe I'm just configuring the crawls incorrectly. These addresses rank, but I'm worried that we're losing some link juice along the way. Any thoughts would be appreciated!

                          Technical SEO | | jamesm5i
                          0
                        • littlesthobo

                          Moving from a .com to .co.uk

                          I need to migrate a wordpress site from domainname.com to domainname.co.uk. If I just put a 301 on every page on the .com will that cover it? Would it make sense to go and change all the backlinks/profile links to the new .co.uk site or doesn't it matter if you have a 301 redirect on it? Thanks

                          Technical SEO | | littlesthobo
                          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
                        • Vivamedia

                          Set base-href to subfolders - problems?

                          A customer is using the <base>-tag in an odd way: <base href="http://domain.com/1.0.0/1/1/"> My own theory is that the subfolders are added as the root because of revision control. CSS, images and internal links are used like this:
                          internal link I ran a test with Xenu Link Sleuth and found many broken links on the site, but I can't say if it is due to the base-tag. I have read that the base-tag may cause problems in some browsers, but is this usage of base-tag bad in some SEO-perspective? I have a lot of problems with this customer and I want to know if the base-tag is a part of it.

                          Technical SEO | | Vivamedia
                          0
                        • MarkWill

                          Redirecting blog.<mydomain>.com to www.<mydomain>.com\blog</mydomain></mydomain>

                          This is more of a technical question than pure SEO per se, but I am guessing that some folks here may have covered this and so I would appreciate any questions. I am moving from a WordPress.com-based blog (hosted on WordPress) to a WordPress installation on my own server (as suggested by folks in another thread here). As part of this I want to move from the format blog.<mydomain>.com to www.mydomain.com\blog. I have installed WordPress on my server and have imported posts from the hosted site to my own server. How should I manage the transition from first format to the second? I have a bunch of links on Facebook, etc that refer to URLs of the blog..com format so it's important that I redirect.</mydomain> I am running DotNetNuke/WordPress on my own IIS/ASP.Net servers. Thanks. Mark

                          Technical SEO | | MarkWill
                          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.