So I’ve moved my blog from stinogle.com to this new domain. This meant moving over my current posts as well. This post will go through some of the steps I made to not only move my posts over from one WordPress install to another, but how to preserve any accumulated SEO integrity with the posts already out there on the net.

Exporting and Importing

First, I needed to export my posts from my current blog. To do this, I downloaded an export xml file locally. In the admin area of my WordPress install, I headed to:

Tools > Export > Posts

wordpress export page
The WordPress export page.

You can export everything, including pages and custom post types, but I was starting from a cleaner slate, so I didn’t need those. I downloaded the export xml file, and it was on to the import. I headed over to the WordPress admin of my new domain here:

Tools > Import > WordPress

import page
The Importer.

As you can see above, I chose to create a new user to apply all my posts to. WordPress will give you this option for any users you have in the xml file. I also moved all my attachments over.

Cleanup

After importing my posts into the new blog, I noticed that all the links in them were absolute links, pointing to the old stinogle.com domain. I needed a quick way to update all posts at one, so MySQL seemed like the best choice. Check out the code and steps below, and make sure to back up your database first!

SQL

UPDATE wp_posts SET post_content = REPLACE (
post_content,
'stinogle.com',
'robandlauren.com');
  1. Head into your database in PHPmyadmin.
  2. Hit the sql tab, and you’ll be given a text area to enter your code.
  3. We’ll be updating the post content in the wp_posts table, so we’ll make sure our replace statement points there.
  4. The first line in quotes will be what you want to find, and the second will be what text you are replacing it with.
  5. Run the statement, and your posts should be updated!

301 Redirects: The SEO White Night

Now, if you are at all concerned about SEO, you’ll want to 301 redirect any posts you have out there from the old domain over to the new one. A 301 will tell search engines that your site has permanently moved, and any SEO clout you’ve built up will transfer over. In my case, all of my post paths start with the four digit year they are posted, so I needed to put some code together to redirect based on links where the top level directory started with 4 digits. This also ensures that I don’t just redirect every page, as I’ll be keeping the old domain, and I only want the post URLs to redirect over. This is all done in your root .htaccess file, and the code is below.

Apache

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/\d{4}/

RewriteRule (.*)$ http://robandlauren.com/$1 [R=301,L]

And that’s pretty much it. Any questions, feel free to post them, or shoot me a tweet!