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.
lonnyoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineDon't talk to me.Commented:
In order to do this via regular expression and rewrite rules, there needs to be some sort of pattern from the old urls to the new.  If not, you are looking at writing each rule by hand...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lonnyoAuthor Commented:
I tried switching the old blog's permalinks to post name, but when I did that the old links were broken. Not sure if there is a way to make that work.
Jason C. LevineDon't talk to me.Commented:
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.
Lucas BishopClick TrackerCommented:
Here's what I'd do:

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 1

3.

Export the new posts (id, title, permlink), using same method mentioned above, from the new site

4.

Put this new data in a second sheet in the same excel workbook
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:

1.

Title - this can be pulled from either sheet since they should be identical

2.

ID - this is pulled from the old data and needs to be matched with its respective title

3.

Permlink - this is pulled from the new data and needs to also be matched with its respective title
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:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} /archives
RewriteRule ^(.*) http://www.tmicoatings.com/archives/%{REQUEST_URI} [R=301,NC]

Open in new window



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

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.