Redirecting Old or Expired Domains

Use Netlify to get the benefits of page-to-page redirects without the need to maintain dedicated hosting.

Netlify Redirects SEO

Old and Expired Domains

This resource is about redirecting an additional or add-on domain to your primary website domain. We are not talking about redirects within the same domain but rather transferring all traffic, and possibly backlinks, from one domain to another.

There are two primary use cases when this whole domain redirection is required:

  • New Domain: If you're moving your website to a new domain name, for branding or any other reason, you'll want to make sure the old domain name is redirected to the new domain name.

  • Expired Domains: If you acquire a domain name that previously had traffic and/or backlinks you'll generally want to redirect it to your primary domain name. This can also include domain purchases.

Note, as far as SEO goes there's very little reason to redirect random domain names you've purchased on a whim. If a domain has never hosted any content previously, nobody will know about it and therefore there's no traffic or link equity to be redirected.

Why Redirect?

Following on from that last point, redirection serves two purposes: to preserve existing traffic and retain or build equity from external backlinks. This prevents visitors from hitting a dead end and maintains or improves the authority of the website.

In most cases, you will want to redirect on a page-by-page basis to maintain relevancy. For example, if you have an online pet shop you will want your old /dog page to redirect to your new /dog page and your old /cat page to redirect to your new /cat page. This is a much more effective way to retain key SEO signals than a blanket redirect to the homepage.

Netlify for Redirects

Netlify is a platform for building and scaling websites and apps from code stored with a Git provider... but don't worry about that. We're just going to be looking at one particular feature offered by Netlify: Redirects and Rewrites.

Here's the thing, in order to implement page-by-page redirects from one domain to another you'll generally need a server to host your redirect file/list. For Apache based servers this would be an .htaccess file, for example.

It's can be a pain, and sometimes an extra cost, to have hosting purely to host a single redirect file. This is where Netlify comes in, using the free service along with a redirect file hosted via a Git provider (also free) such as GitHub or Bitbucket (we use Bitbucket) we avoid the need for dedicated hosting.

Getting Started

This is how it works:

  1. Sign up for a free Bitbucket account.

  2. Create a Repository (Repo).

  3. Add a file and name it _redirects. We'll cover what goes in this file in the next section.

  4. Sign up for a free Netlify account.

  5. Create a New site from Git and choose the Repo from Bitbucket.

  6. Add a Custom domain under the Domain management options in Netlify.

All done! Now whenever you update your _redirects file it will automatically get deployed to Netlify for your custom domain.

Redirects File

The format of the redirects file in Netlify is fairly straightforward. Here's a couple of examples of what goes in your _redirects file to get started.

The _redirects file can be edited online using the Bitbucket console, so there's no need to get down and dirty with Git and editing files locally.

# Single domain Netlify redirects
/	https://newdomain.com/	301
/cat	https://newdomain.com/cat	301
/*	/	301!
# Multi domain Netlify redirects
http://olddomain.com/	https://newdomain.com/	301
https://olddomain.com/	https://newdomain.com/	301
http://olddomain.com/cat	https://newdomain.com/cat	301
https://olddomain.com/cat	https://newdomain.com/cat	301
http://olddomain.com/*	https://newdomain.com/	301!
https://olddomain.com/*	https://newdomain.com/	301!

This is what it all means:

  • # any line preceded by a # is a comment and will be ignored by Netlify when processing these rules.

  • Each line is comprised of three parts separated by a space or tab character: source, destination and status code.

  • 301 is the default status code, so technically we don't need to include this but I find it's good to include anyway.

  • An exclamation mark ! after the status code is a way to force the redirect. By default if Netlify finds a file at one of the paths it won't process the redirect but using the ! overrides this behaviour.

  • * is a wildcard used as a catchall in these examples to redirect any other paths to the homepage. To maintain the matching wildcard portion of the path, use :splat on the destination URL.

  • Redirect files are processed from the top down, so it generally makes sense to place wildcards at the end to account for any paths that might have been missed without overriding any of the rules above.

  • If you use relative paths e.g. / instead of https://mydomain.com/ as the source then all custom domains assigned to the site in Netflify will use these rules.

  • If you want one file to manage redirects for multiple domains, and the rules need to be different, this can be achieved using full qualified URLs. Note, HTTP and HTTPS require separate rules as will WWW and non-WWW so you'll need to account for the various combinations.

Note, it's important to add your custom domain before adding your redirects otherwise Netlify, or rather Let's Encrypt, won't be able to provision an SSL/TLS certificate for the domain. Without an SSL/TLS certificate HTTPS redirects won't work, instead the browser will show a privacy error notice.

Now you know how to use Netlify to implement redirects without having to pay for or maintain your own hosting.

On average, our clients see a +60% increase in traffic and +65% increase in revenue from search in the first 12 months.

Get a Custom Proposal It's Free