Moving your website to a new domain

Technology Blog

Since we’ve just moved this site from one domain to another, I thought I’d write a quick few words about how we did it.

  1. Register and point the domain to your hosting. The hosting package we use (which we like so much we resell it), makes this an easy process. We bought the domain using a third party registrar, added it to our hosting, and set the nameservers for the domain. Within a couple of hours we were ready to go.
  2. Create the new site on the new domain. We weren’t changing our hosting, so that removed one potential area of risk. No new PHP settings or the like to worry about.
    Depending on how your site is built, making sure it is served from a different domain and that all internal links are correct may be a very straightforward or a very tedious exercise. Most Drupal sites can be served from different domains very painlessly, without even needing to move any files. With WordPress it is generally necessary to make a number of database edits. One way I have found to deal with this is to take a full MySQL dump and go through it using a text editor, looking for references to the old domain and changing as necessary. (Warning: don’t entrust this job to a non-technical person!) Restore the edited file to a new database and point your new site at it.
  3. Test the new site. A web site spidering tool such as Xenu Link Sleuth or REL Web Link Validator can be used to ensure all the pages of the new site are being served correctly. For this task I used Web Link Validator, because its page rules feature enabled me additionally to check for references to our old company name and flag them up as exceptions.
  4. Redirect from old site to new. Our site hosting permits the use of .htaccess files and URL rewriting so it was quite easy to create a rule that would redirect any request for the old site to the corresponding URL on the new one:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} !^figure-w.co.uk$ [NC]
    RewriteCond %{REQUEST_URI} !/google.*\.html
    RewriteRule ^(.*)$ http://figure-w.co.uk/$1 [L,R=301]
    

    This rule says that any request for a domain other than “figure-w.co.uk” is redirected to figure-w.co.uk. Apart from the domain name all the parts of the original URL are preserved. A 301 redirect is used because that says that the redirection is permanent, so search engines will update their indexes.

    The second line of the rule is there for the benefit of Google Webmaster Tools, so the verification file it uses to check your ownership of a site can continue to be fetched from the old domain. This then enables you to use a relatively new feature of Webmaster Tools called “change of address” , to tell it directly about the redirection. It’s a requirement of this feature that both old and new sites must be verified on the same Webmaster Tools account, which means the verification file must be able to be fetched without redirection.

  5. Change your inlinks. A well-established site like ours has a lot of links pointing to it from elsewhere on the web.  Because our old domain is ultimately going to be transferred to another company, it’s been important for us to get as many of those links changed to point to the new site as possible. Both Google Webmaster Tools and Yahoo Site Explorer provide lists of inlinks that you can download and import into a spreadsheet to help plan this process.
  6. Tell people! Don’t forget to let as many people as possible know about your move. We’ve been issuing press releases, a newsletter and sending emails as well as using Twitter and Facebook to spread the word. We probably could do more, and maybe this post will help, too.

Got an interesting story about moving domains? We don’t pay for contributions, but we’d love to hear it anyway!

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>