8 SEO tips for migrating your site

Kate Dreyer explains why maintaining search rankings when moving to another domain needn’t be a chore – if you do things right.

Whether you've expanded your business into a new market, or simply want to help existing international customers find your site more easily, it's important to maintain your web presence in international markets. Sometimes, this can involve moving an existing website from one domain to another.

But that doesn't mean you have to risk your traffic and search engine rankings to do so. In this tutorial, I'll take you through some of the basics that you should think about before, during and after a big international site migration, so you can be sure your website and business don't suffer.

01. Domain Choice

Whatever your reason for migrating your website, you should put some thought into the domain you want to move to. After all, you don't want to have to go through all this again in a year or two.

Obviously, your choice of domain depends on a variety of factors, but when taking search engines into account, you should bear the following in mind:

  • Global top-level domains (gTLDs)example.com, example.org, example.net – These domains can rank in any country, and search engines view them as fairly authoritative.
  • Country code top-level Domains (ccTLDs) example.co.uk, example.de – Country-level domains will typically only rank in their equivalent country, so if you want to market your site across the globe, don't use one of these. By the same token, though, these domains send strong signals to Google about which country you are targeting, so you won't need to set up any additional geo-targeting.
  • Subdomains subdomain.example.com – Subdomains are now treated as entirely separate domains by search engines – however, it is generally advisable to avoid them unless you have a good reason for doing otherwise.
  • Sub-directories example.com/sub-directory – Sub-directories are useful if you want to have separate sites for each market, but can't purchase each individual ccTLD for your brand name. Sub-directories can be geo-targeted using Google's Webmaster Tools, so ranking shouldn't be an issue. You can also use sub-folders to leverage the authority that the TLD may have built up over time, giving your new site a boost.

If you're simply changing your business or domain name and are keeping the TLD the same, then you probably won't see much negative effect in terms of search engine rankings. However, if you're moving from a .com to a sub-directory or vice versa, then you might have issues when the search engines try to rank your site in the relevant countries. There are ways around this, of course, which I'll go into later in this article.

02. 301s

Redirects are probably the most important part of any migration, because they make sure both users and search engines are taken directly to your new site. Using permanent 301 redirects ensures that most of the value from your old pages is passed onto the new ones. 302 redirects don't pass any value, so avoid them if you can. 301 redirects can be set up on each individual page, or by using the .htaccess file. For page-level redirects, simply add the following to the <head> section in your page's code:

<meta http-equiv="refresh" content="0; url=http://www.newdomain.com/page">

If all your new URLs are identical to the old ones, save for the domain, you can cut down the effort and use a simple regex in your .htaccess file, located at your site's root:

RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

The following shows the regex you would use to redirect a .co.uk domain to a .com domain:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]

If, however, your new URLs have a completely different structure, you'll need to do a bit more work to correctly map and redirect all the old pages to the equivalent new ones. If regex isn't your strong point, a quick Google search should provide you with an example to copy. Plus, luckily, it's a one-time job so you won't need to worry about it again.

03. Language

Search engines strive to present the best content possible to users, and helping them to understand the language of your content – and the country you want to target – will go a long way towards helping it rank well.

The main way to signal to search engines that your site is written in a particular language is to use hreflang tags, which can be added either to the <head> section of the page or to a sitemap.

A hreflang tag added to a single page would look something like this:

<link rel="alternate" hreflang="es" href="http://example.com/es/page.html" />

The above tag shows Google that the specified page in the /es sub-directory is written in Spanish.

If you have a large number of different sites, sub-directories or languages, then using a hreflang sitemap representas a much easier option.

A hreflang sitemap sits on the site's root, in much the same way as a standard XML sitemap. It enables you to list all your domains, pages and languages. The various languages for one URL would be written out like this:

    <xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/de/page1.html" />
    <xhtml:link rel="alternate" hreflang="fr" href="http://www.example.com/fr/page1.html" />
    <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/en/page1.html" />

The hreflang sitemap should include every page of your site, with a list of every equivalent page in the various languages. This means that the file can get pretty large. It's important to cover everything, though, otherwise Google may see your pages as being duplicates – which can generate major ranking problems for you.

04. Geo-location

As well as stating the languages, you should also tell Google which country you want to target. You can do this easily using Google Webmaster Tools. If you have a ccTLD this is automatically set as the domain's default country; however, if you are using sub-directories, sub-domains or a global domain, then definitely spend five minutes setting this up. Just go into the Site Settings menu, accessible via the small cog icon in the top left of your Webmaster Tools dashboard. Once this is set, Google should start to index and rank your site in the correct country.

05. Sitemaps

XML sitemaps are important to ensure your newly migrated site is crawled and indexed by the search engines quickly and efficiently.

Creating a sitemap is really simple, and there are a number of online tools that generate an XML file from a list of URLs you provide. Once you have migrated your site successfully, create a sitemap of the new URLs and upload it to the site's root with the standard filename: www.example.com/sitemap.xml.

Next, you should submit the sitemap to Google using Webmaster Tools. The Sitemaps section is located in the left-hand menu underneath the Crawl heading.

The Sitemaps section enables you to see how many pages have been successfully submitted and crawled, helping you to identify and rectify any issues with your sitemap or your site's structure.

06. Robots.txt

A robots.txt file is essential when migrating a website. First of all, you don't want your new site to be crawled and indexed by Google while your old site is still around, so you need to block it until it's ready to go live. To block the entire site, add the following code to the robots.txt file and upload it to the site's root:

User-agent: *
Disallow: /

To block a single sub-directory, simply use the folder name instead of the slash:

User-agent: *
Disallow: /folder-name/

Once your new site is ready to rock and roll, unblock it and submit your sitemap to Google. When you're happy it's being indexed, and you've checked your 301s are redirecting to the right places, you can block the old site. Google should then get a good idea of what's going on and swap the sites in their search results. You may see a slight drop in some rankings, if your pages are vastly different, for example. But generally everything will return to normal within a couple of weeks.

07. Change of address

Just like moving house in the real world, you need to notify the post office – or in this case, Google – of your new address. This is really simple and, again, can be done within Webmaster Tools. First, you need to add your new site to your Webmaster Tools account and verify it. Then simply choose the Change of Address option in the settings menu and select the new site under the drop down menu that appears.

08. Reporting links

Another element of SEO that shouldn't be overlooked during a site migration is link building. 301 redirects don't pass 100 per cent of the value gained from external links, so always look for opportunities to repoint your links if you don't want to lose any of that hard-earned authority.

If you have been conducting targeted content creation and manual outreach, then you should already have developed relationships with some of the site owners who have linked to you. This means that repointing these valuable links is just a case of pinging off a few emails.

However, link building comes in many forms and it can be difficult to contact everyone who has linked to your content, especially if you haven't built the links yourself. Thankfully, there are a few tools out there that can help you manage the process.

Entering your domain in to Moz's Open Site Explorer tool will give you a list of all the sites that have linked to your site. Once you've exported the list, it's just a case of manually checking each one and finding some contact details to request that the link is changed to point to the new URL.

You can use Open Site Explorer for free, but for a full list of your links you need to sign up to Moz Pro and pay a monthly fee.

Linkdex is another really useful tool that helps you pull contact details for the sites that are linking to you. As well as email addresses, you can also view Facebook, Twitter and Google+ profiles of site owners, drastically cutting the time you need to spend on research. Linkdex also comes at a cost but, if you have a large number of links to repoint, it's well worth the investment.

It's that simple!

If you check each of these small tasks off your list, you'll be well on your way to a well-optimised website that's loved by search engines all over the world.

Words: Kate Dreyer

Katie Dreyer is a digital marketer, writer and feminist. This article originally appeared in net magazine issue 256.