Tag Archives: wordpress

Converting WordPress Multisite to a single site

creative commons licensed ( BY-NC-SA ) flickr photo shared by Packfill
A few years ago, in a fit of ambition and desire to host all the things, I set up my school blog as a wordpress multisite with four separate blogs, three of which had separate subdomains: one for my face to face classes, one each for my online classes, and one for Pedagogy First! (oh yeah, and there’s this personal blog too).

Now, it’s too much. I don’t want to update five blogs. Hell, I’m not even really keeping up with one. Additionally, for some inscrutable algorithmic reason, Google responds to searches by my students for my blog with links to my online class blogs, which have lain dormant for years, rather than to my main school blog.

Enough. One school blog and one personal blog are enough. So how do you go back? (First obviously, you back up, and then you go back. You’ve been warned.)

This wpmudev blog post walked me through it, but I’ll post instructions here as well for  future reference.

I used file manager in cPanel to edit my wp-config.php file (first I copied it to wp-config.old in case I screwed up). I then deleted the following lines:

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/wordpress/';
define( 'DOMAIN_CURRENT_SITE', 'localhost' );
define( 'PATH_CURRENT_SITE', '/wordpress/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

The wpmudev post called for editing my .htacess file to match the following, but mine was substantially the same, so I left it alone:

RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]

Next, I edited my wp-config file and dropped the following tables from my database. I’m pretty sure there’s room for disaster in all of the above steps. Backup.


At this point, the other blogs were gone, and I had a single blog. (And by gone, I mean GONE–this doesn’t merge all the subdomains–it just deletes everything but the main blog.)

One thing left to fix: redirecting the subdomains. I had to create a wildcard subdomain, so when someone goes to [subdomain].learningbusiness.net, it still showed the subdomain in the address bar. In cPanel, I went to the subdomain panel and added an explicit subdomain for each of my former subdomains and then I went to the redirect page in cPanel and added a redirect to my main URL so that if someone types the old subdomain, it redirects to the main domain and keeps the URL consistent. PedagogyFirst posts, on the other hand, I redirected to the EdTech category here on my personal blog where I imported all of my old posts. I’m sure I’ve broken a few links on other people’s posts (sorry!), but my posts are still there to be found with a little digging.

Seemingly inevitable result of importing @wordpressdotcom xml export file to self-hosted @wordpress blog:

Configuring WordPress Multisite with Subdomains in cPanel

I’ve been using blogs for my online classes for several years now, first using free WordPress.com blogs, then moving to a self-hosted wordpress installation with a certain currently unpopular hosting provider who shall remain nameless. In August, when my hosting contract, ran out I decided not to renew and to move my domains elsewhere. I used iwantmyname.com to manage my domains, and used free services (posterous and tumblr) to host my blogs. It worked OK (and was certainly cheaper than paying for hosting), and I was even able to set up subdomains for my different class blogs (blog.domain.com, not domain.com/blog), which my old provider didn’t allow. 

After a semester of free hosting, however, I was ready to go back to hosting my own installation. I went with Bluehost on the recommendation of friends, and also because they allow subdomain WordPress installations. Their tech support was helpful in matters of basic setup, but weren’t very knowledgeable about how to set up a multiple subdomain sites within WordPress. In fairness, their support only extends to getting WordPress installed, which went flawlessly. The problem I had, though, was that even though the main blog was easy to set up, I couldn’t access any of the subdomains. I read several pages about using a wildcard domain in cPanel, but none of them were clear enough for someone with skills as rudimentary as mine (so now I’m going to spell it out).

Two sets of instructions finally got it through my thick skull: Joe at aboundmarketing sent me to the cPanel subdomain page, and the WordPress Codex finally allowed me to figure out where the wildcard needed to point (NOT the default “wildcard” folder that cPanel wants to setup).

Joe writes “For ‘Document Root,’ type in the folder where your WordPress installation is located,” and the Codex writes, “Make sure to point this at the same folder location where your wp-config.php file is located.” I should have figured it out then, but it took me a bit more poking around. Elsewhere, the Codex writes, make sure that both the site address and the WordPress address are the same.” In other words, WordPress has to be in the public_html directory, and the wildcard domain has to point to public_html. (It’s a basic syllogism, right? WordPress must be in the public_html directory; the wildcard must point to the WordPress directory; therefore, the wildcard must point to the public_html directory.)

tl;dr: Point your wildcard subdomain to public_html, not a subdirectory of public_html

One more thing (about RSS)

Watch on Posterous

One more thing I like about WordPress blogs is that even if you can’t find a feed button, the default feed is [domain]/feed. So for example, if I’m reading Law and the Multiverse and can’t find the RSS feed, I know I can point my feed reader to http://lawandthemultiverse/feed and follow any updates.

(Edited because I realized that although Pedagogy First! uses WordPress, it doesn’t use the default feed. Test links, then post. Doh!)