Skip to the indexed answers
Digital Marketing Index

usdigitalmarketingindex.com SEO

How should a blog be migrated from a subdomain into the main site’s subfolder?

URL by URL: every post, category, tag, author page, feed, and image on the subdomain gets a matching address under the folder, a permanent redirect from the old to the new, and updated links everywhere the old address was used. A move from blog.example.com to example.com/blog/ changes the hostname of every URL, so it is a site move in the sense of Google’s guidance, which describes the Change of Address tool as being for moves “from one domain or subdomain to another” (Google’s guidance on site moves with URL changes). Whether the tool accepts a move from a subdomain into a folder is something to confirm in the tool at the time. The error that undoes such a move is the catch-all: sending every old blog URL to the new blog’s front page. Each article has its own links and its own place in search results, and each needs its own destination.

Content path mapping

Decide the path scheme first, and keep it as close to the old one as possible.

Old and new blog URL examples with matching destinations:

Type Old URL New URL
Blog home https://blog.example.com/ https://www.example.com/blog/
Post https://blog.example.com/how-to-bleed-a-radiator/ https://www.example.com/blog/how-to-bleed-a-radiator/
Dated post https://blog.example.com/2023/04/boiler-pressure/ https://www.example.com/blog/2023/04/boiler-pressure/
Category https://blog.example.com/category/heating/ https://www.example.com/blog/category/heating/
Tag https://blog.example.com/tag/thermostats/ https://www.example.com/blog/tag/thermostats/
Author https://blog.example.com/author/jordan-ellis/ https://www.example.com/blog/author/jordan-ellis/
Pagination https://blog.example.com/page/3/ https://www.example.com/blog/page/3/
Feed https://blog.example.com/feed/ https://www.example.com/blog/feed/
Image https://blog.example.com/wp-content/uploads/2023/04/gauge.jpg https://www.example.com/blog/wp-content/uploads/2023/04/gauge.jpg
Sitemap https://blog.example.com/sitemap.xml https://www.example.com/blog/sitemap.xml, or merged into the main sitemap

Keeping the path after the hostname unchanged, with only the /blog prefix added, lets one pattern rule do the mapping and removes a class of mistakes. If the slugs must change too, treat that as a second change and consider doing it separately: Google’s guidance advises changing one thing at a time where possible.

Check for collisions before settling the scheme. Does the main site already have a page at /blog/, or a path that a blog slug would duplicate?

Inventory the blog fully: crawl it, export the post list from the CMS, read its sitemap, and pull the URLs with clicks and links from Search Console. Posts no longer linked from anywhere still have addresses.

Server routing and redirects

Two pieces of server work.

Serving the blog under the folder. Options:

Method Description
Same platform The blog's content is imported into the main site's CMS
Reverse proxy The main domain's server passes requests for /blog/ to the blog's existing platform
Separate installation in a subdirectory The blog software is installed under /blog/ on the main host

Whichever is used, the blog must generate its own URLs with the new base address, so that links, canonicals, and feeds name example.com/blog/ and not the subdomain.

Redirecting the subdomain. On the old hostname:

https://blog.example.com/(anything)  ->  301  ->  https://www.example.com/blog/(same path)

Requirements:

  • Permanent: the guidance recommends server-side permanent redirects such as 301.
  • Path-preserving: the query string too.
  • One hop: also from the http and any www variant of the subdomain, directly to the final URL.
  • Covering files: images, PDFs, feeds.
  • No catch-all to /blog/: the guidance warns against redirecting many old URLs to a single irrelevant destination.
  • Posts that are being retired at the same time return 404 or 410 at the new location, or are redirected only to a true equivalent.

Keep the subdomain’s DNS record and certificate alive. The redirect needs a working HTTPS endpoint on blog.example.com to answer from.

CMS and analytics changes

Area Change
Site address settings in the blog CMS New base URL
Internal links inside posts Rewritten from subdomain URLs to folder URLs; search the database for the old hostname
Image sources in posts Rewritten
Canonical tags New URLs
XML sitemap New URLs; submitted under the main site's property
Structured data New URLs in article and breadcrumb markup
Main site navigation Links to /blog/
Links from the main site to blog posts Updated to folder URLs
robots.txt The main domain's file now governs /blog/; check it does not block the path. The subdomain's file must still allow crawling so redirects are seen
Feeds and email subscriptions Feed URL updated with the provider; old feed redirected
Comments and embeds Third-party comment systems keyed to URLs need their mapping updated
Social share counts and embeds May be tied to old URLs
Analytics The blog now reports under the main property; update filters, content groupings, and cross-domain settings; annotate the date
Cookies and consent The blog now shares the main domain's cookie scope and consent banner
Search Console The subdomain property stays verified; the folder is covered by the main property; try Change of Address from the subdomain, and proceed without it if the tool does not accept the move

On Change of Address, the guidance says the tool is for “moving from one domain or subdomain to another”, with the example of a.example.com to b.example.com. A subdomain-to-folder move is not among its examples, so open the tool for the subdomain property and see whether it accepts the main site as the destination. If it does not, the redirects, sitemaps, and canonicals carry the move.

Validation and post-move monitoring

Before launch, on staging:

Check Pass condition
Every inventoried old URL maps to a new URL Complete
New URLs load 200
Canonicals on new URLs Self-referencing, on the main domain
No subdomain references in new pages Search rendered HTML for the old hostname: none
Images load from new paths Yes

At launch:

Check Method Pass condition
Redirects Request every old URL from the inventory One 301 to the matching new URL, final status 200
Variants Request http and other variants Same destination, one hop
Files Request image and feed URLs Redirected and loading
robots.txt on both hosts Fetch Neither blocks the move
Sitemap Submit the new one Read without errors
Spot check in Google's tools URL Inspection on several new post URLs Fetchable; canonical is the new URL

After launch:

Indicator Source Expectation
Subdomain URLs Page indexing, subdomain property Becoming redirected
Folder URLs Page indexing, main property, filtered to /blog/ Indexed
Clicks Performance, subdomain plus /blog/ on the main property, summed Subdomain declines as folder rises
Not-found errors under /blog/ Page indexing and server logs None from mapped URLs
Requests to the subdomain Server logs Continuing, and all answered with redirects
External links Links report Reassigned to folder URLs over time

Expect a period of adjustment. The guidance says rankings may fluctuate temporarily during a move, and that a small to medium-sized site can take a few weeks for most pages to move.

Then ask the sites that link to the most-visited posts to update their links, and keep the redirects. The guidance says to keep them for as long as possible, generally at least a year.

Whether a blog belongs on a subdomain or in a folder in the first place is a strategic question, weighed in the guide to when a publisher should place SEO content on a subdomain rather than a subfolder.

The order of work: fix the path scheme, serve the blog under the folder with its own URLs corrected, redirect every subdomain URL to its match, update every reference, then verify by request and monitor both properties.

Link trail

Reader comments on this answer

Add your comment to this answer

Your email address will not be published. Required fields are marked *