lonnyo
asked on
Redirect old blog posts to new blog
I need to redirect an old wordpress blog to a new wordpress site. We converted the regular site to a new wordpress site and have moved all the blog posts from the old blog to the new site.
The old site links look like this:
http://www.tmicoatingsblog.net/archives/1658
The new site links look like this:
http://www.tmicoatings.com/fertilizer-tower-painting-by-tmi/
The sample links above are for the same post. Unfortunately, when the blog posts were moved over, the shortcodes are not the same value as the old blog (which is the number appearing in the old url). I tried searching this on the internet and thought I had a solution, but nothing seems to be working. I am looking for a solution so I don't have to do every redirect by hand. There are over 500 redirects.
The old site links look like this:
http://www.tmicoatingsblog.net/archives/1658
The new site links look like this:
http://www.tmicoatings.com/fertilizer-tower-painting-by-tmi/
The sample links above are for the same post. Unfortunately, when the blog posts were moved over, the shortcodes are not the same value as the old blog (which is the number appearing in the old url). I tried searching this on the internet and thought I had a solution, but nothing seems to be working. I am looking for a solution so I don't have to do every redirect by hand. There are over 500 redirects.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Not really. This is the kind of thing you have to decide very early on in the blog's life. Switching it now won't help you.
Here's what I'd do:
Now, on a third sheet using vlookup you'll use the "title" (since it matches between both sites) as the commonality to set up these columns:
Now you have a sheet that contains two critical mapping components:
The old ID (Ie. the 1658 seen in this url: http://www.tmicoatingsblog.net/archives/1658)
The new permlink (ie. the fertilizer-tower-painting- by-tmi http://www.tmicoatings.com/fertilizer-tower-painting-by-tmi/
With this, you can easily create an htaccess file that contains a 301 redirect for all the old IDs mapped to the new url.
The old site htaccess would look like something like:
The new site htaccess would have around 500 lines similar to this that you'd have created via excel:
1.
Export the old posts (id, title). You can do this direct from the DB or using a plugin like https://wordpress.org/plugins/export-to-text/2.
Put this data in an excel workbook on sheet 13.
Export the new posts (id, title, permlink), using same method mentioned above, from the new site4.
Put this new data in a second sheet in the same excel workbookNow, on a third sheet using vlookup you'll use the "title" (since it matches between both sites) as the commonality to set up these columns:
1.
Title - this can be pulled from either sheet since they should be identical2.
ID - this is pulled from the old data and needs to be matched with its respective title3.
Permlink - this is pulled from the new data and needs to also be matched with its respective titleNow you have a sheet that contains two critical mapping components:
The old ID (Ie. the 1658 seen in this url: http://www.tmicoatingsblog.net/archives/1658)
The new permlink (ie. the fertilizer-tower-painting-
With this, you can easily create an htaccess file that contains a 301 redirect for all the old IDs mapped to the new url.
The old site htaccess would look like something like:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} /archives
RewriteRule ^(.*) http://www.tmicoatings.com/archives/%{REQUEST_URI} [R=301,NC]
The new site htaccess would have around 500 lines similar to this that you'd have created via excel:
Redirect /1658 /fertilizer-tower-painting-by-tmi
ASKER