Code to redirect surfer from a no ‘www’ address

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.

Popularity: 1% [?]

One Comment

  1. Busby SEO Challenge (7 comments.)
    Posted August 2, 2008 at 10:04 pm | Permalink

    I would have thought a 301 redirect would have made more sense in this regard especially since that option is more search engine friendly.

    Busby SEO Challenges last blog post..Website Hosting Options

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*