Officially : Learn To Migrate Your Site To A New Domain

I’ve made the official migration for this site from to You’ll see that all URL’s will redirect to the new URL. You’ll also notice that all URL’s are now shorter!? For example the post for the 2009 Nissan 370Z used to be:

Now it is:

The new domain name is part of the migration that I had announced when I launched this new design. My next task will be to work on cleaning up all of the categories, and the posts within them.

For those interested in how I did the migration, in case you are interested in doing the same…I will provide the steps I took:

Backup Files

The easiest/fastest way for me to do this was to login via Telnet/SSH (I use Putty as the software to do this). Go to the directory you need to backup, and then type

tar cvf filename.tar .

This will back everything up in the directory to a .tar file. Simply download that tar file and reupload to your new server. On the new server, you’ll want to untar it by using this command in the same directory:

tar xvf filename.tar .

This will untar all of your files onto the new server. Trust me, doing this is MUCH faster then downloading all of your files via FTP.

WordPress Configuration

I was doing everything on the same server, so I didn’t have to do anythign with the database. If you are using a different server, you’ll have to backup your database, and then restore it on the new servers database.

Since I was doing everything on the same server, I simply logged into WordPress, went to settings, and changed the domain names to This changed the database config to the new domain, and automatically started calling the files on the domain.

While in the WordPress admin, I also updated these:

  • All In One SEO Tool plugin – Renamed everything as needed
  • Sitemaps plugin – Rebuilt the sitemap for the site to map the correct domain

Update Template Files

Go into all of your template files, and make sure to change any references you have from the old domain to the new domain.

Update Old Domain References In Content

You could go through your SQL database files and replace any references of your old domain to your new domain…but an even easier way is to use the search-regex plug found here. The plugin once installed allows you to search for anything in your content and replace it with something else. I simply searched for all the references to images using the old domain, and replaced them with Same thing with links. Now all of your content is calling the right files.

.htaccess Configuration

You’ll want to update your .htacess configuration on both domains to make sure you’re URLs are doing what they are supposed to. To get all of the old url schemas shorter, I added this line (Thanks WPRecipes!):

RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$$4

This will ensure any links that are going to the old URL’s automatically redirect to the new ones. Plus, it will allow the search engines to know the pages have moved, and start indexing the correct new URL’s without punishing me (since there is no page not found errors). While I’m at it, I also set the domain up to always redirect to, even if you go to just The code for that is below:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^davepit\.com [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Now we’ve got all setup…but we want to make sure people that are still going to get redirected. Simple!? I setup a .htaccess file on with the following code:

Redirect 301 /

Perfect!? Now our URL’s are going to the right places!

Google Webmaster Tools

You’ll want to setup the new domain on Google Webmaster Tools so Google can appropriately crawl and index your content.

Thanks to Mubs from Suffolk Software for some of the help in figuring out the above work.