Code to redirect surfer from a no 'www' address
Posted on August 28, 2007 by Andy Bailey
This bit of code sends everyone to the same address whatever they used (http://fiddyp.co.uk goes to http://www.fiddyp.co.uk, also redirects .com addresses to the .co.uk one)
if ($_SERVER["HTTP_HOST"] != "www.fiddyp.co.uk") {
header("Location: http://www.fiddyp.co.uk");
pretty sweet little function, put it in your header and google wont think www.you.com is different from you.com and penalize you for having duplicate content.
Filed under: Code