This actually isn’t hard to do, but it can be tricky to complete if you don’t remember what you started with.
To start with, let’s say I have a multisite with subdomains: ipstenu.loc. I’ve added in two subsites, foo.ipstenu.loc and bar.ipstenu.loc. But then I decide I really wanted to have ipstenu.loc/bar and ipstenu.loc/foo instead.
The easy part is first. I know my
wp-config.php has this:
define('WP_ALLOW_MULTISITE', true); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); $base = '/'; define('DOMAIN_CURRENT_SITE', 'ipstenu.loc'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE',1);
All I have to change is the one line
define('SUBDOMAIN_INSTALL', true); to
define('SUBDOMAIN_INSTALL', false); and now I’m using sub-folders!
But that means that foo.ipstenu.loc isn’t really valid. Amusingly, it doesn’t break anything at first, so the still will work. But once I change the .htaccess, things will get hinky, so I’m going to do the ‘hard’ part.
Go in to Network Admin -> Sites and Edit each site that uses a subdomain and you’ll see this:
Looks familiar, right? I’m going to change
ipstenu.org and the line with
That’s because I have to edit the
.htaccess. Go to Network Admin -> Settings -> Network Setup, and copy the
.htaccess from there, replace, and now it works too.
The one last step is re-saving the permalinks in your main site, and remembering your links are about to break. What’s that now? Oh, yes, you see ipstenu.loc now gets /blog/ shoved in for any posts, so ipstenu.org/2012/postname became ipstenu.loc/blog/2012/postname. The catch here is that if you don’t resave the permalinks, they will continue to work until you do. Once you hit ‘save’ on permalinks, blog jumps in, and WordPress cheerfully redirects people for you, so you lose nothing.
And now you know!