So you decided to move to another domain? Great! Is there anything to do apart from finalising your new fancy site design? Nah, that’s OK, Google and users will figure out the change by themselves.

End of the post.

Well actually, by doing so, you will probably screw up your site migration, dropping your new fancy site into  the depths of the organic search results and leaving your audience clueless.

Since here at FIRST we do care about making the Web a better place, we have compiled some tips for doing you site migration right!

Map Old URLs With New Ones & Set-up 301 Redirections

First, create or update the sitemap of your old site. You can do so with a site crawler such as the Crawl Test tool from SEOmoz or by any other means. Identify http status errors (500, 404, 302), fix them (internal links, redirections) and keep only the 200 OK status URLs.

Then match each URL to the most relevant new one. This can be relatively painful if URLs’ patterns are drastically different but be patient as it is worth doing it if you want to maintain your organic rankings by passing the sweet SEO “juice” from your old to new URLs.

Once you have your URL matching file, you need to set-up permanent (301) redirects by creating RewriteRules in the .htaccess file. Hopefully, you will be able to use regular expressions so you can save a bit of time.
For instance, you would write the following for a site using Apache:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^olddomain.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com
RewriteRule ^/olddirectory1/old-subdirectory1/(.*)$ http://www.newdomain.com/newdirectory1/new-subdirectory1/$1 [R=301,L]
RewriteRule ^/olddirectory1/(.*)$ http://www.newdomain.com/newdirectory1/$1 [R=301,L]

Explanation:

  • The first line “RewriteEngine On” enables the Rewrite Engine module in Apache.
  • The RewriteBase directive is used to specify the directory which the RewriteRule directives will apply on. In this case, RewriteRules apply for all URLs available at the root level domain.
  • RewriteCond directives are conditions needed for the underneath RewriteRules to be processed.
  • RewriteRule directives are then applied in the specific order they appear. In our example, if the 2 RewriteRules are reversed, http://www.oldomain.com/oldirectory1/old-subdirectory1 will redirect to http://www.newdomain.com/newdirectory1/old-subdirectory1.
  • The first part of the RewriteRule uses regular expressions. So make sure you escape special characters (such as – or .) by using a backslash before.
  • The backreference  $1 in the second part of the rule will be replaced with whatever text will be matched by the expression inside the parenthesis in the first part of the rule. In this case everything as (.*) means “everything”.
  • You specify the redirection is permanent by adding the [R=301] flag.
  • The [L] (last) flag tells that if the RewriteRule matches, then stop processing the rules. This will allow reducing the time needed to perform that request.

Set-up a Canonical Hostname & URLs

Having a preferred domain (non-www OR www) is advised to avoid duplicate content.
To force the use of the www.  hostname, you can create a rule like below:

RewriteCond %{HTTP_HOST} !^newdomain.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.newdomain.com/$1 [R=301,L]

Normalising URLs with a trailing slash also helps to avoid duplicate content and slightly speed up http requests.

RewriteCond    %{REQUEST_FILENAME}  !-f
RewriteRule    ^(.+[^/])$           $1/  [R=301,L]

Set-up Webmaster Tools & Submit Sitemaps

To reduce the time needed for search engines to figure out your domain has moved, it’s a good idea (not to say an absolute necessity) to create a Google and Bing Webmaster Tools account and submit Sitemaps for your new domain.

You can also notify the change of address of your old domain site under the Webmaster Tools account you may already have:

Notify the change of address of your domain in Google Webmaster Tools

You can even re-submit your old sitemaps so that Google and Bing will crawl your old URLs again and see that they now permanently redirect to your new domain.

Monitor Crawls Errors & Fix Them

A few days after your site migration, closely monitor URL errors from your Webmaster Tools account, see where they come from and fix the wrong redirections and internal links.
Google Webmaster Tools is also a good tool to identify which sites redirect to your domain with wrong or outdated links. Then you can contact sites’ webmasters to ask them to update these links.

Notify the change of address of your domain in Google Webmaster Tools

By following this quick list, you should be able to smoothly migrate your site while maintaining your awesome organic rankings.

If you have a site migration project to handle, please contact us and we’ll help make sure your new site gets the love from both search engines and users!