How I Moved from WordPress.com Without Paying for the Redirect

3 minute read

The Problem

I just moved this blog from WordPress.com and wanted to share about an unexpected hiccup and how I worked around it: WordPress.com wanted to charge me $17/year to forward visitors to my new self-hosted site.

While $17 a year isn’t going to break the bank, the principle of the matter is this: it costs them nearly nothing to redirect visitors to my new site (in fact, it’s probably much cheaper than hosting the old site). What’s really going on here is that WordPress.com is feeling jaded, and so she slapped me in the face with an unexpected fee. Well, I’ll show it…

It’s hard to work around, because WordPress.com is good about not allowing me to add any Javascript to my posts, which could take care of performing the redirect (like I did when I migrated from blogger.) And they certainly didn’t let me touch any HTTP headers. So what to do…

My Solution

Basically, I replaced the post content from all posts with a link pointing to the same post on my new blog. So basically it’s a manual redirect. I think humans will find it intuitive enough, although I’m not sure about search engines. Oh well, the best is yet to come, and I’m not paying $17!

So for I manually update all 100+ posts? No, the gist of what I did was this:

  1. Exported all my posts from WordPress.com to a file
  2. Replaced cmljnelson.wordpress.com with cmljnelson.blog in the file
  3. Used Notepad++ to do a regex Search-and-replace to change the post content of all posts in the file (more details in a moment)
  4. Trashed all my posts on WordPress.com (otherwise, in the next step, they won’t get updated)
  5. Imported the posts back into the WordPress.com site
Using NotePad++’s Search-and-Replace

Here’s the regex for selection:

<title>(.*?)<\/title>(.*?)<link>(.*?)<\/link>(.*?)<content:encoded><!\[CDATA\[(.*?)\]\]>

and here’s the replacement string:

<title>$1</title>$2<link>$3</link>$4<content:encoded><!CDATA[<p>I've moved from WordPress.com to a self-hosted site!</p><div class="wp-block-button aligncenter"><a class="wp-block-button__link has-background has-vivid-cyan-blue-background-color" href="$3">View the Post "$1" on my New Blog</a></div><div class="wp-block-image"><figure class="aligncenter"><a href="$3"><img src="https://cmljnelson.blog/wp-content/uploads/2019/05/img_8498.jpg" alt=""/></a></figure></div>]]>

So if you’re familiar with regex’s, you’ll see I’m grabbing the post’s title and URL, then stuffing them into the new post content. (Note: if you’re actually using this for your site, note that I needed to make sure I skipped the first occurence of the regex pattern, as it matched the site’s “title” tag, which isn’t what we want.)

Now every post on my old WordPress.com site looks like this:

My old site from a mobile phone.

Oh, and a few other miscellaneous changes:

  • I renamed the site to “CMLJ Nelson’s Old Blog”
  • I replaced all the menu items with a single link to my new site
  • I changed the homepage to be a similar simple page with a link to my new site
  • I removed all the widgets (to simplify the page)

Why Not Pay the $17 Annual Fed?

I don’t want to keep paying it perpetually, and don’t want to pass my credit card info over to someone more (I haven’t spent a penny on this blog yet, although they have had advertisements on it, and I think my content has been beneficial to WordPress ecosystem.)

Should WordPress.com do the redirect for free? Maybe it’s necessary to make ends meet (I got a ton for free), but I’m still using JetPack for the time being, so I haven’t completely abandoned Automattic’s services. But I know replacing my entire old site with a simple redirect wouldn’t cost them a penny, and would cut down on a lot of expenses (they’re still hosting 3GB of my images), and was what I expected they would do when I decided to grow up and leave the WordPress.com home.

(Right now it feels like I moved out but my parents are charging me to forward my mail… it’s just a little rude and uncharacteristic of the people who raised me… 😕)

Anyways, tell me I’m a fool in the comments.

PS: The featured image is another masterpiece by my daughter. It’s “fluffs” going on a boat ride.

One thought on “How I Moved from WordPress.com Without Paying for the Redirect

  1. In the spirit of transparency, I’m seeing about half of the visitors of my old site, cmljnelson.wordpress.com, following the links to visit this new one, cmljnelson.blog. So while this may be good long term (so I won’t need to pay for the redirect forever), I may give in and pay for it afterall this year…

Leave a Reply