Page is a not externally linkable
lobo235 - 1:49 pm on Nov 30, 2005 (gmt 0)
This can also be done using the .htaccess file with apache. Check out the apache we server forum to find more info on using that method.
Well, the reason that you would want to do it is to avoid getting hit with a duplicate content penalty from Google. For example, if you have the page www.example.com/index.html it will also exist at example.com/index.html. Google and other engines may give one of the sites (either non-www or www) a penalty and most the pages will not show up in the search engine's index. Here is the snippet from my common.php file that performs the permanent redirect from non-www to www: if ( $_SERVER["HTTP_HOST"] == "example.com" )
{
header( "Location: http://www.example.com".$_SERVER["REQUEST_URI"] );
exit( );
}