This article walks you through the process of using a 301 redirect script in PHP. The 301 redirect is a very efficient method of webpage redirection. More importantly, it is search engine friendly.
In order to utilize a 301 redirect, you will need to add the following PHP code to a page on your site (replacing http://www.domainname.com with the actual destination URL):
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.domainname.com" );
?>
In most cases, you will need to insert this script on a default document such as index.php or default.php in order to redirect a fully-qualified domain name.
NOTE: This script can be inserted in your web root or a sub-directory.