Tuesday, October 21, 2008

Redirect from old to a new web site

There are several ways to handle this issue, generally.

First is permanent redirect. It is achieved by adding the line

Redirect 301 http://<newwebsiteurl>.com

to .htaccess file in the root folder of the web site. The web server will automatically redirect all requests to the new location properly. If one requests a certain page from the old site the web server will redirect to the same location in the new web site. This works great if you are simply moving the whole site and keeping the structure in place. But, this will not work with Googlepages.

Second approach is client-side redirect, using Meta tag. Using this tag you can redirect to a new location and specify the time after which redirection occurs. Example:
<meta http-equiv="refresh" content="5;url="> 

This will redirect client browser to the new web site after 5 seconds. Placing 0 instead of 5 will redirect immediately. One of the drawbacks of this method is that search engines will still keep the links to the old web site.  This tag has to be placed into <head> tag of the page, which is not accessible with Googlepages templates.

This issue can be worked around by adding the new URL to search engines.

Redirect pages at the old site can also contain a hard-coded link to the new site/pages so that the new links get indexed by search engines and that the users can reach the link manually in case their browser does not support meta redirect (refresh) tag.

Another way is to use JavaScript to redirect to another page. Placing the following code will work with browsers that support JavaScript. This option would probably have no effect on search engines but is the only one that works with pages on Googlepages.

No comments: