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…
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:
- Exported all my posts from WordPress.com to a file
cmljnelson.blogin the file
- 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)
- Trashed all my posts on WordPress.com (otherwise, in the next step, they won’t get updated)
- Imported the posts back into the WordPress.com site
Here’s the regex for selection:
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:
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)
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.