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.
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.
I exported to Excel and took a few minutes to clean it up manually to get only the addresses of blog posts.
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:
On the second I did this one:
I called these sheets Old and New, then made a 3rd sheet called Final and used this formula:
=CONCATENATE(Old!A1, " ", New!A1)
Boom.
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
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.
thank you very much! Needed this