My boss, Paul Allen (the lesser) asked me to blog about how I redirected his entire blog site to new domain without losing traffic. So at the risk of boring some of my more technical readers, but also in the name of retaining my job, here goes. :)
Before the Move
First, the part I didn’t do. Before the old site could be redirected, the new site had to exist and look sharp. Blake created a mock-up of the new look and feel and sent it to XHTMLized, a great company in the UK that returned a working WordPress theme the very next day for $150. Mike installed the latest WordPress on the new domain and put Paul on a blogging freeze while he imported the database from the old domain.
List Links that Should Redirect
Once Mike was finished, I made a list of links to the old domain that should redirect to the new domain if clicked or pasted into the browser. I picked a link to each different page type that I could think of. Although yours may vary (depending on what type of site your moving and what kind of link structure your using), my list of old links looked like this:
I emailed this list to myself so I could test each link out after the redirect. Be thorough when making your list so that you don’t lose readers (or traffic from important links) during the move. For instance, if you forget to redirect your feeds, plan on losing your most tech-savvy readers.
Use Consistent File and Directory Naming Structure
If you use a similar (or at least consistent) directory and filename structure on your new site, you should be able to write just a few redirect rules rather than one for every page. If you’re just copying an normal directory to a new location, you don’t have to do anything here. If you’re using a CMS like WordPress, make sure that your new site is using the same permalink structure. In WordPress this is configurable in “Options > Permalinks”. The end goal is to keep the URLs of each of your pages looking similar.
You can test whether a redirect will be simple by doing a find and replace on your link list, then testing the new links. In my example I replaced “infobasemedia.com/blog” with “paulallen.net”, then tested each link to make sure it brought me to the appropriate page on the new site. They did. If yours do too, your redirect will be easy. If they don’t, you should probably fix your new site and try again. Alternatively, you can do a redirect for each page type, but it will be more difficult. It may however be the desired effect, if the whole reason for redirect was to modify your directory structure without taking a hit in traffic.
Decide if you want “WWW” in your URL and Stand by Your Decision
After I tested my new links, I tested whether the new links also worked without the “www”. They did. This may seem counterintuitive, but for SEO purposes, you actually don’t want them both to work. Or better, you want one to be a server alias redirecting to the other so that links to either URL land on just one, which is good for Google Juice. Which should you choose? It doesn’t really matter as long as you’re consistent. Traditionalists like the “www”. Some newfangled whippersnappers don’t.
Since I didn’t do the server alias for paulallen.net (Mike did), I’ll show you the pertinent parts of virtual host configuration file for Provo Labs.
Redirect permanent / http://www.provolabs.com/
This makes it so that if you try to go to http://provolabs.com/, you will be redirected to http://www.provolabs.com/. Is this vital moving a website? No. But it’s nice, and it’s better setup the site properly before you start directing traffic to it. At the very least you should know whether you want to include the “www” so that you can redirect it to the one that you plan on ending up with.
Making the Redirect
So, after much testing, you should finally be able to make the redirect. This is actually very simple. You just want to test it beforehand to make sure it’s seamless for your readers.
Here’s the code I put in the .htaccess file of the old blog site.
# Redirect permanent /blog/ http://www.paulallen.net/
Pretty easy, huh? I clicked save and opened up my list of links that should work. But some didn’t. I quickly commented the redirect out and looked again. There were some mod_rewrites on the old site that needed to be deleted for it to work properly, a common problem having to do with the permalink structure. So I removed the offending code, saving it in a separate file for backup. With the next try, it all worked. There were only about 2 seconds of traffic lost in my first attempt, and even that landed on the new site –it just didn’t land on the right page at the new site.
This is all just guesswork, but one important thing to note here is that you should probably use the permanent redirect. This tells people to update their links to your pages. It also tells Google that links coming to your old address should be credited to the new one. Despite this, you will see your PageRank go to 0 because Google dings your new address for being new. Don’t worry about that; nobody cares but you. If the traffic and content is still there and all inbound links are landing (with a permanent redirect) on the right pages, your users are still happy and your PageRank should go back up with a little time. In the interim you will still probably still place fairly well in natural search results for Keywords that you have really targeted. And for traffic from paid results and links, your PageRank obviously doesn’t matter.
But if you have a for-profit site that sells seasonal products and you need the money to eat, you might consider doing the switch in a slow season. And if you can afford to have something decent on the new URL being indexed by Google even months before you make the redirect, that would probably help too. Again, this is guesswork.
Despite testing all the main page types, we still missed a small number of pages because we did a database dump and import rather than copying an entire directory. Overall, we did what we wanted to do, and under normal usage it would have been perfect. But we forgot to check the old blog’s document root for html files and directories that were created outside of the standard WordPress administration panel and were (therefor) not in the database. The omitted pages were insignificant enough that we would not have known immediately that they didn’t work. Luckily Mike decided to use a link checker (like the free one I mention here) to verify all the links on the new site worked. Sure enough, there were some broken links to content that should have been there, but wasn’t. So there’s a little clean up to do (even still), but chances are that none of his readers noticed.
Do it Right the First Time
Demming’s seventh rule of TQM is “Do it Right the First Time”. The same axiom applies all over in life, and it certainly applies here. If you can get your site setup in the right directory and the domain in the first place, you save effort and uptime down the road. So if you can, just do it right the first time. Pretty obvious, I know –but it does take a little foresight and planning.
Well, hopefully that wasn’t the longest post you ever read. If it was I apologize, but you might not be in this mess had you exercised a little self-control earlier on. Despite it’s length, I hope that somewhere in this long mess of verboseness you found a little nugget of wisdom that will be helpful to you the next time you move a website between domains or otherwise. If not, it must be because you didn’t look hard enough. Try reading it again. :)
PS. Let me know if I missed anything.