Traffic redirection (HTTP Permanent redirect 301) for visitors and google
The bottom line: if you copied your website to function under a new domain name, for best results with search engines, first inform the search engine of the change, then, use the free Domain name redirection service that comes FREE with your domain name, it will redirect every page to the page with the same location under the destination domain, and such setup is 5 clicks away, with this setup oldsite.com/aboutus.html will redirect to newsite.com/aboutus.html !
page traffic redirection or HTTP redirection is the process of informing web browsers and web robots/crawlers of a page's new location, in the case of http redirection, this is done via header redirection directives, where a header redirection instruction such as Location: http://newlocaion.com/filename.html explicitly informs a browser of the new location as well as changing the status code of the page from 200 (OK) to 301 (Permanent redirect)
Traffic redirection (for browsers and search engines) tells a browser or search engine where to find every document on the new website, or in other words, where it has been relocated, Search engines will probably move all the variables tied to the old page to the new one, variables such as Google's page rank.
For example, google will probably migrate the page rank from the old page to the new, and it would also probably propagate page rank from the links to the old page to count for the new page.
After setting up a replica of your old website on your new website, follow these steps to inform google of the change, right after we finish this we will setup redirection for all pages on the old website to the new website.
Google allows webmasters to change there website address from within the google webmasters website, Here we will demonstrate 4 ways to redirect all pages of your old website to the counterpart pages on the new website (in compliance with google guidelines).
The google guidelines for redirection
1- Redirect every page to it's counterpart on the new website.
2- Make the redirector permanent (HTTP code 301).
For example, if you have been running a website called acmestuffconsulting.com and wish to change it to acmeconsulting.com you would probably move all pages from the old website to the new website and then edit the domain name in all the files to the new domain name without changing any folder or directory structure, in this case, the best way to do the redirection is to use the EasyWebDNS auto redirection service.
In other scenarios when you want to change subdomains or change page locations on the domain, there are 3 other methods that can be used, here we will demonstrate how to implement forwarding using the tools in your domain name control panel, PHP, htaccess, and finally PHP with MOD_REWRITE (htaccess directive)
| Method | Pros | Cons |
| EasyWebDNS auto redirection |
1- Every page is mapped to the same path on the new domain |
1- Some special cases don't work. |
| Manual page redirection | 1- Very flexible 2- very Customizable 3- Does not require any special hosting setup as long as the pages are interpreted by the web server as being of a dynamic type like PHP or ASPX |
1- Tedious 2- High error rate 3- not feasible for very large websites 4- Only works if your old pages are interpreted by the server as dynamic pages (Like ASP) |
| Redirecting with htaccess |
1- Easy to setup |
1- requires capable hosting service such as EasyWebDNS Linux hosting 2- Changes and exceptions require understanding of regular expressions. |
| Page redirection using MOD_REWRITE | 1-Fairly easy to setup 2- Same results as EasyWebDNS redirection, but can be modified quite a bit to accommodate special cases and scenarios |
1- A bit more tedious than EasyWebDNS redirector |
The EasyWebDNS auto redirection service is the best choice when you simply want to change your domain name, it will redirect all pages to the same address on the new websites
So in the example above, a visitor or search engine visiting http://www.acmestuffconsulting.com/aboutus.html would be permanently redirected to http://www.acmeconsulting.com/aboutus.html
Setting up this redirector is simple and easy
Your are done, give it some time for the DNS to propagate through your ISP then visit any address on the old domain and you should be redirected to the same address on the new domain name
The redirection service is included free with every domain name you buy from EasyWebDNS.
This method is the manual method, Simply put, if your pages are PHP pages, All you need to do in this case is replace the PHP pages on your old website with pages like this one.
Remember that you will need to edit the following code to redirect to the new location, This script is meant to also send along all get parameters.
In PHP, all HTTP get parameters are in the array $_GET, we will pass them to the new destination anyway.
<?php
$getcount = 0;
$getstring = '';
if((isset($_GET)) && (is_array($_GET)))
{
$getcount++;
foreach($_GET as $getkey => $getvalue)
{
if($getcount == 1)
{
$getstring .= "?{$getkey}={$getvalue}";
}
else
{
$getstring .= "&{$getkey}={$getvalue}";
}
}
}
header("Location: http://www.newdomainname.com/newpageloc.php{$getstring}",TRUE,301);
?>
The true in the PHP header above means this header should replace any similar headers sent before it
This method does what an EasyWebDNS redirection does but on your own hosting account, Although almost automatic, editing some settings requires a bit of knowledge in regular expressions and Apache htaccess directives
The very basic redirection settings should be like
This method combines the advantages of the EasyWebDNS redirection with the advantages of the manual redirection, but if you wish to use the script to create exceptions and store such exceptions in a database for example, some knowledge of PHP is required
Here, it replicates the EasyWebDNS domain redirection service, you can however edit it and use it in any way you wish.
1- htaccess
Copyright, V.CheapDomains 2010