Redirecting traffic

Redirecting traffic
14 November 2003

Changing a site’s domain name, while not an ideal scenario, is sometimes necessary for a variety of reasons. These can include a company rebranding, setting up a companion site or extranet, or the acquisition of a more user friendly domain name. Whatever the reason, redirecting the traffic is a major consideration.

One of the ways to achieve this, which we will look at here, is a redirect page. You’ll have seen them frequently before, a page advising that the site has moved and if you are not redirected within five seconds to click the link.

But how do they do that?

The fail safe method is this:

Within the <head> and </head> tags in your source code add
<meta http-equiv="refresh" content="1; url=http://www.ournewsite.com/">

Then between the <body> and </body> tags of the same page, add If the new site doesn't load, use this link <a href="http://www.ournewsite.com/">Visit www.ournewsite.com</a>

(It goes without saying that ournewsite.com is replaced with your new target location)


You can also use JavaScript for this purpose. Between the <head> and </head> tags in your source code add
<script language="javascript">
<!--
var time = null
function move()
{
window.location = 'http://www.ournewsite.com'
}
//-->
</script>

Then replace the body tag with this
<body onload="timer=setTimeout('move()',3000)"> where 3000 is the time in milliseconds until the redirect commences.


It’s also a good idea on the redirect page to remind visitors to renew their bookmark to you when they get to the new site.

By reminding visitors to bookmark the new site, it will be possible to eventually take down the redirect altogether. If you intend retaining the old domain, remember to point it at the new site and then re-submit it to the search engines.