Moving website pages is not only a traumatic experience but it actually does your website more harm than good when not done right. The Google Search algorithm uses over 200 elements to rate your website and one of these elements is how reliable your website pages are. When a “Page Cannot Be Found” message is displayed, this is one mark less for your website which means that your search ranking will likewise be affected. If you need to redirect your Web pages, then you need to do it in a way that search engine spiders and visitors will find it “friendly.”
PHP Redirect Code
Using the PHP redirect method requires that you call the “header ()” first before anything else. Nothing else, even an “include ()” statement or an empty space, should be allowed before the “header()” is executed. The code examples below show the right way of implementing this:
<?php
header (“http/1.1 301 Moved Permanently”);
header (“Location: http://www.developerdrive.com”);
?>
The first header information tries to figure out the HTTP status code that should be sent when missing files are found. The information in the second line is sent back to the browser together with the status code.
Some developers skip the first line entirely and just go with the second line as shown below:
<?php
Header (“Location: http://www.developerdrive.com”);
?>
While this redirect may work, it will result in a “302 Moved Temporarily” redirect message instead of a 301 redirect. This is not a Search Engine friendly redirect and should be avoided.
JavaScript Redirect
JavaScript redirects allow for a lot of flexibility when it comes to redirects. For example, it is easy to implement a timed delay redirect that forwards visitors to a new web page after a set time. With JavaScript, you can redirect all your visitors to a new URL using the script below:
<script type = “text/javascript”>
<!—
Window.location = http://www.developerdrive.com/
//->
</script>
To implement a timed delay redirect using JavaScript, use the code below:
<html>
<head>
<script type = “text/javascript”>
<!—
Function delayer() {
Window.location = “../javascriptredirect.php”
}
//- - >
</script>
</head>
<body onLoad = “setTimeout (‘delayer ()’, 5000)” >
<h2> Redirection in 5 Seconds! </h2>
<p> Please update your bookmarks to reflect our new website! </p>
</body>
</html>
HTML Redirect Code
When redirecting using HTML, you need to ensure that any tricks that are targeted towards Search Engines may get you banned. Ensure that only the code below is placed inside the <Head> and </Head> tags of your HTML code:
<meta http-equiv="Refresh" content="5”; url=http://www.developerdrive.com/">
The “Content=”5”” parameter tells the browser to wait for 5 seconds below redirecting to “DeveloperDrive.com.”
Redirection using .HTACCESS file
.htaccess file is a configuration system file. With this file, you can redirect an entire site to a different URL, a single file to a specific subfolder, or redirect old files to new paths.
Online Tools
Some online SEO resources are able to automatically check if your redirects can be crawled correctly and that the redirects have been set up right. Once you make a redirection, use these tools (e.g. www.webconfs.com) to ensure that your redirects are Search Engine friendly.
Regardless of what method you use, permanent redirects are more search engine friendly than temporary redirects which should be avoided if possible.