Recently, I moved a Wordpress blog from one domain to another. Most of the time, I work with blogging platform transfers or possibly moving the domain from one host to another.
In this case, I needed to direct traffic arriving at any page on the old domain to the same page on the new domain. I knew that I wanted to do a 301 redirect, but I hadn’t anticipated how simple the whole thing would be. I had anticipated a long list of redirects.
But it turns out that if you migrate a Wordpress blog from one domain to another domain, then all you need to do is make a small change to your .htaccess file at the old domain.
If there isn’t anything about the “RewriteEngine” in the .htaccess file, then add the following:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Replace www.newdomain.com with whatever your new domain is. Use “www” or not as you see fit.
However it’s quite likely that in the section following:
# BEGIN WordPress
you’ll find the first two lines:
Options +FollowSymLinks
RewriteEngine on
Directly after those, before any other rewrite commands, place:
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
again replacing www.newdomain.com with the blog’s new domain.
This works on Linux servers which have Apache Mod-Rewrite enabled. That sounds very technical, but it’s also what’s offered by a large number of hosting companies. If you don’t know whether or not you have that, give the redirect a shot. You can always contact your hosting company if it doesn’t work and ask for their suggestions.
It takes about 20 seconds to do. And this works whether or not you still have Wordpress installed on the old domain. I deleted the entire Wordpress installation and just left the redirect up. Every link goes through to the new site.
A 301 redirect isn’t as good as a direct link, but in terms of traffic and even SEO it’s a best choice. Gives you time to find out who’s linking to your old site and ask them to change while making people follow those old links to the right place anyway.
If you've found this article useful, why not get new posts in your RSS reader or in your e-mail? Your e-mail will only be used for new posts and you can unsubscribe at any time.




{ 6 comments… read them below or add one }
Um, you’re a genius! Thanks so much for this tip. Saved me from creating a LONG list.
Hi Ms. Crafty
That sounds way simple..But let me confirm..Doing this will redirect a visitor coming to http://www.olddomain.com/2010/03/page to http://www.newdomain.com/2010/03/page right?
Also, should I continue to retain both my domains or can I discard my old domain after sometime?
Thanks a lot for this post..
Anand Srinivasan´s last blog ..Social Networks Access Via Mobile Browsers
Yes, that’s what will happen. As long as the site is now at the new location, it’ll work smoothly. Otherwise they’ll get redirected to that page but there won’t be anything there. You’ll need to keep the old domain as long as you think there’s incoming traffic. If it didn’t have many links, then after a year when the search engines have switched over you’ll probably be fine. But if a lot of people had linked to it, then when you discard it you lose all that traffic (unless you get the people to change their links).
Thank you..Got it now..

Anand Srinivasan´s last blog ..Apple’s A4 Chip Made From Intrinsity, Not PA Semi?
Hi,
I am a software developer and use wordpress extensively to build various websites for our company clients.
The redirect process explained here will redirect everything but is there a way to redirect only one page? Something like redirecting http://yoursite.com/home/ to http://yoursite.com/ ?
Hi Sweta, try:
RedirectMatch 301 ^/home/$ http://yoursite.com/