When you install WordPress Mu, it warns you:
Please choose whether you would like blogs for the WordPress µ install to use sub-domains or sub-directories. You can not change this later. We recommend sub-domains.
It’s true there’s no documented way to change this setting, and the current advice is to reinstall (!), but I aim to change that. Instead of reinstalling plugins, reconfiguring plugins, and then powering through the nightmare that is WordPress export->import, I resolved to find whatever setting was buried in WordPress and do it manually. And lucky for me, it turned out to be surprisingly easy.
I’d originally set up welcome.totheinter.net to use subdomains for my Mu installation, but I decided recently that subdirectories would make much more sense. After all, I’m using Mu to power my one site, and subdomains feel like lots of separate sites. In retrospect, installing Mu as subdomains was the wrong decision.
So during some downtime in the ‘ole ICU last month, I decided to see if this weren’t, in fact, a solvable problem, and it turns out it’s a pretty easy fix.
Step 1: Backup your database and config file
I’ve always subscribed to the “protect my data from my #1 enemy: me!” mentality.
Step 2: change each blog’s URL
In the admin console, go to the blogs page.

For each blog, click the edit link to edit that blog’s details. You’ll want to edit the following fields to all be consistent with the new location you want each blog:
- Domain
- Path
- Siteurl
- Home
- Fileupload Url
For instance, I used to have one of my blogs set up at http://page2.welcome.totheinter.net/ but I moved it to http://welcome.totheinter.net/notes/. To do that, I changed the Domain from “page2.welcome.totheinter.net” to just “welcome.totheinter.net” and the Siteurl from just “/” to “/notes/”. I similarly updated all of the other fields for that blog.
Step 3: Update wp-config.php
There’s one line in the wordpress config file that tells Mu to use subdomains instead of subdirectories. Change:
define('VHOST', 'yes');
to:
define('VHOST', 'no');
Step 4: Update httpd.conf
If you’ve set up Mu to use subdomains, then you need to undo your wildcard subdomain setup in your httpd.conf. Matt Mullenweg has a great post explaining how to create the wildcard domain in the conf, so if you’re trying to go from subdirectories to subdomains it’s a great read.
If you’re going from subdomains to subdirectories (like me), just remove the wildcard domain from your httpd.conf and restart apache.
Make sure (of course!) that you still have a virtual host defined for your actual site’s domain. It should look something like:
<VirtualHost 207.58.152.45:80> ServerName welcome.totheinter.net ServerAlias www.welcome.totheinter.net DocumentRoot /home/internet/public_html/welcome ServerAdmin webmaster@welcome.totheinter.net UseCanonicalName Off </VirtualHost>
Optional Step 5: Redirect from old subdomain to new subfolder
Good SEO tells you to redirect a URL you move to it’s new location with a 301 redirect header. To do that, I first setup a subdomain in CPanel that matched the blog’s old subdomain location. Then I just edited the .htaccess file for that subdomain to point all incoming traffic to the new URL. The .htaccess for page2.welcome.totheinter.net is now:
RewriteEngine On RewriteBase / RewriteRule ^(.*) http://welcome.totheinter.net/notes/$1 [R=301,QSA,L]
Conclusion
It turns out resetting WordPress Mu to use subdirectories instead of subdomains isn’t all that bad! And I’d imagine that moving from subdirectories to subdomains requires near identical steps.
Hope this helps you out – it’s certainly saved me from a reinstall hell!
27 responses so far ↓
1
adamwulf
// May 6, 2009 at 9:06 pm
convert subdomain WordPress Mu install to use sub/directories/ instead: http://tinyurl.com/ctoomg
This comment was originally posted on Twitter
2
mlane
// May 7, 2009 at 9:06 am
Changing WordPress Mu from Subdomains to Subdirectories – http://bit.ly/Yrlko
This comment was originally posted on Twitter
3
Cambiar Wordpress MU de subdominios a subdirectorios | Codigo Geek
// May 7, 2009 at 11:01 am
[...] en subdominios, no podremos cambiarlo luego a subdirectorios si no es reinstalando. Pero en éste blog publican un tutorial que muestra una forma “no oficial” de hacerlo y parece terminar [...]
4
DarklgWeb
// May 7, 2009 at 11:41 am
Changing WordPress Mu from Subdomains to Subdirectories http://minurl.fr/fdw
This comment was originally posted on Twitter
5
465media
// May 7, 2009 at 1:38 pm
Changing WordPress Mu from Subdomains to Subdirectories http://ow.ly/5DAj #wordpress
This comment was originally posted on Twitter
6
Andrea_R
// May 7, 2009 at 1:45 pm
Yep, that does work if you have only the main blog and maybe 1 or 2 blogs to burn through.
Now imagine how fun that would be for someone with 300 blogs.
There *IS* a script available for this, but it is unreleased. It will be out there soon-ish though.
7
Adam Wulf
// May 7, 2009 at 2:23 pm
true enough
for the i-have-tons-of-blogs people it won’t won’t be terribly efficient, but it was a painless enough process that i can imagine doing it for a few tens of blogs easily enough.
for the people who just can’t wait, hopefully this’ll tide people over till the script is released.
8
ariyo
// May 7, 2009 at 11:23 pm
Changing WordPress Mu from Subdomains to Subdirectories http://tr.im/kNzB
This comment was originally posted on Twitter
9
JAC2
// May 8, 2009 at 7:08 am
This is EXACTLY what I was looking for the other day. Thanks!
10
ivan
// May 9, 2009 at 2:50 pm
thanks so much!!!
just had a fuckup with dreamhost, i dont wanna use their PS, so i decided to turn everything away.
Thank you so much!!!
11
BuddyPress Links #7 · Buddypress Links
// May 12, 2009 at 9:12 am
[...] How to change WordPress Mu from subdomains to subdirectories [...]
12
Inderjeet Singh
// Jun 9, 2009 at 4:02 am
I was looking for this for my fresh Buddypress+Mu install. Hope the plugin for this releases soon
13
Teleflux
// Jul 31, 2009 at 12:34 pm
This was helpful, however, I didn’t have to edit the httpd.conf
14
Greg
// Aug 20, 2009 at 10:46 pm
This was very helpful.
Thanks alot!
15
Anup
// Sep 7, 2009 at 1:49 am
Plz tell me whether its possible to have two instances of WPMU installed at the root – one working with subdirectory structure and the other working in subdomain structure?
thanks
16
Adam Wulf
// Sep 7, 2009 at 2:28 am
Anup, as far as I know it is not possible to run both subdomains and subdirectories at the same time. that said, i’d post over at http://mu.wordpress.org/forums/ and see if those guys have any ideas. the forums generally have solid advice.
17
Eileen
// Sep 7, 2009 at 10:34 pm
Thanks so much – this was exactly what I needed on my new install (I picked subdomains when I shouldn’t have!)
18
Nik
// Nov 18, 2009 at 8:31 am
Thanks, solved my problems.
19
Jason Bonham
// Nov 27, 2009 at 12:39 am
Thankyou,
very helpful information. My hosting service took care of the wild card part. You can always add that to the directions, so newbies like myself are aware of the potential option.
20
Ivan
// Dec 10, 2009 at 2:27 am
Would there be any hiccups if I reverse the process from subdirectories to subdomains?
21
henrik hammer
// Dec 10, 2009 at 4:15 am
Just a note: it’s important to remember the trailing slash ‘/’ for the new subdirectory, when updating the settings in step2
22
Jussi
// Jan 27, 2010 at 9:02 am
Thanks! This was just what the doctor ordered
23
Simeon Mus
// Jan 30, 2010 at 6:11 am
Thank you for the article. It will help me very much.
Andrea says “There *IS* a script available for this, but it is unreleased. It will be out there soon-ish though.”
Is it released since then? Where can we find it, please?
thanks
24
Dwayne
// Mar 9, 2010 at 12:33 pm
This worked like a charm – I set it up with subdomains originally, thinking I’d convince godaddy to make it work, but I failed. I had just one blog to convert, quick and simple.
thanks
25
Artful Dodger
// Mar 19, 2010 at 3:57 pm
Hey, thanks very much for this post, worked perfectly without any hiccups, again, thanks a bunch.
26
bloggista
// Jun 18, 2010 at 3:37 am
This is exactly what I need. Thanks for this valuable info. I’ve been long wanting to switch from subdomains to subdirectory but I was just kinda lazy to do a re-install. will try this one and hope it works.
27
TechieChic
// Jul 19, 2010 at 1:19 pm
Thank you so much! I had only just barely installed WordPress MU and had picked the wrong option and realized it as soon as I clicked the install button. Definitely nice to not have to start all over, since for me it was just a simple change in the wp-config from “yes” to “no”!
Leave a Comment or