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:\r\n\r\n\r\n\r\nNow it is:\r\n\r\n\r\n\r\nThe 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.\r\n\r\nFor those interested in how I did the migration, in case you are interested in doing the same…I will provide the steps I took:\r\n

Backup Files

\r\nThe 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\r\n

tar cvf filename.tar .

\r\nThis 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:\r\n

tar xvf filename.tar .

\r\nThis 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.\r\n

WordPress Configuration

\r\nI 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.\r\n\r\nSince 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.\r\n\r\nWhile in the WordPress admin, I also updated these:\r\n


  • All In One SEO Tool plugin – Renamed everything as needed
  • \r\n

  • Sitemaps plugin – Rebuilt the sitemap for the site to map the correct domain
  • \r\n


Update Template Files

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

Update Old Domain References In Content

\r\nYou 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.\r\n

.htaccess Configuration

\r\nYou’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!):\r\n

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

\r\nThis 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:\r\n

Options +FollowSymLinks\r\nRewriteEngine on\r\nRewriteCond %{HTTP_HOST} ^davepit\.com [NC]\r\nRewriteRule ^(.*)$$1 [L,R=301]

\r\nNow 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:\r\n

Redirect 301 /

\r\nPerfect!? Now our URL’s are going to the right places!\r\n

Google Webmaster Tools

\r\nYou’ll want to setup the new domain on Google Webmaster Tools so Google can appropriately crawl and index your content.\r\n\r\nThanks to Mubs from Suffolk Software for some of the help in figuring out the above work.

No comments have been posted yet, why don't you be the first?

Add A Comment

Note: We use Gravatars, they are little icons that appear next to your name on this site and on many others. You can get a Gravatar account for free and any other site that supports it will show your avatar too!

No trackbacks yet