Redirecting Old WordPress Permalinks to a New Domain
Posted on May 06, 2009 by Ashleigh
Since making the decision to rebrand The Blog of a Freelance Web Designer, Happy Plastic has been born. After the time consuming exporting and importing of old posts it occurred to me that moving my old blog to a new domain was just like starting again. Happy Plastic wouldn’t have any existing links point to the new domain and I would have to start advertising from scratch again. Atleast, that’s what I thought. I was relieved to find out that wasn’t the case.
If you have recently moved a WordPress blog from one domain to a new domain, it is possible to setup a SEO friendly redirect from all of your old posts to you new ones. In my case, all of my old WordPress permalinks were the same as my new WordPress permalinks with the only difference being the domain name. Where I used blog.ashleighjames.com the new domain was happy-plastic.com and the rest of the link was the same. In order to maintain traffic and already established search engine rankings, I setup a SEO friendly redirect to my new posts maintaining the same permalink structure.
My Old WordPress Permalinks
http://blog.ashleighjames.com/%category%/%post-title%
My New WordPress Permalinks
http://www.happy-plastic.com/%category%/%post-title%
The Problem
Without setting up a redirect for every single post already published on the old domain, how could I redirect each post to it’s counterpart on the new domain?
The Solution
Sure, it is possible to setup a redirect for each post. Considering I’d had 37 posts already published that would have been a lot of messing around. For a larger blog, it would have been a nightmare! The solution in this case however was relatively simple and easy enough for anyone to implement. Using your .htaccess file, you too can setup a simple WordPress permalinks redirect that will point your old posts to your new ones.
In the .htaccess file of your old blogs root directory, delete the WordPress rewrite section and paste in the following code.
RedirectMatch 301 (.*) http://www.your-domain.com$1
Save the file and then try going to one of your old posts.
You should now be redirected to the same post but on your new blog!
To see the redirect in action, try going to one of my old blog posts.
Promote Your Website and Make Money
It redirects to the same post but at Happy Plastic instead!
4 Responses to “Redirecting Old WordPress Permalinks to a New Domain”
Leave a Reply






Jenny Kumar
- 9th May, 09 02:05am
I really liked your post.
Ashleigh (author comment)
- 11th May, 09 02:05am
Thanks Jenny.
^_^
Mike
- 29th Jun, 09 05:06am
FYI, your 301 code is wrong.
RedirectMatch 301 (.*) http://www.your-domain.com$1 results in broken redirects.
You’re missing a /
RedirectMatch 301 (.*) http://www.your-domain.com/$1 is what you want.
Ashleigh (author comment)
- 4th Jul, 09 04:07am
Actually it’s not wrong. It’s dependant on the WordPress installation and the root domain specified. In my case, the / at the end of the domain is inclusive, hence not needing to use it in the 301 redirect.
Thanks for pointing it out though.
To anyone looking at implementing a redirect when moving a blog to a new domain – try both including and leaving out the / to see which works for you.