How I Moved 100+ Blog Posts To Another Domain With 301 Redirects

First step, move everything over.
This is pretty simple, just use the WordPress Export and Import available in the Tools section of the dashboard menu.
Screenshot_060616_053513_PM
I did a quick run through and unpublished any posts that I didn’t want to appear on the new domain. In my case there were only a few.
Next up, get a list of posts from the old domain. I used Screaming Frog for this part.
Screenshot_060616_053932_PM
I exported to Excel and took a few minutes to clean it up manually to get only the addresses of blog posts.
Screenshot_060616_054046_PM
Next, I need to get these into the following format:
Redirect 301 /pageurl/ https://www.newdomain.com/pageurl/

Simple enough with a couple of find and replace searches.
I made a copy of the sheet, and on the first sheet I did this replace:
Screenshot_060616_054630_PM
On the second I did this one:
Screenshot_060616_055103_PM
I called these sheets Old and New, then made a 3rd sheet called Final and used this formula:
=CONCATENATE(Old!A1, " ", New!A1)
Boom.
Screenshot_060616_055907_PM
Then I just opened up Sublime, added a couple of lines at the top to start the rewrite engine, and pasted all my rewrites!
Options +FollowSymLinks
RewriteEngine on
Screenshot_060616_060147_PM
P.S. Don’t forget to backup your .htaccess 😉 Just in case.
Mine worked on the first try, but that is because I’ve done this quite a few times on other sites. When I first started, I usually had to try like 30 different methods before it would finally work. lol.
At this point, I moved all of the posts to the trash. Gulp. No biggie though, the trusty .htaccess has my back and is doing his job well.
Screenshot_060616_062015_PM

Other Helpful 301 Redirect Resources:

One Comment

  1. thank you very much! Needed this

Leave a Reply

Your email address will not be published. Required fields are marked *