Different page rank with and wihtout www

Discussion in 'Google' started by ahelpinghand, Apr 30, 2007.

  1. #1
    It was sent in the server administration forum but I think it's more interesting here.
    I don't have access to .htaccess file so I have to think PHP.

    I checked the pages of my site with and without www, I've found out that both versions have the same PR. It's only different with the home page as without www it has PR 3 and with WWW it has PR 2.
    I put this in my home page:
    <?php
    if (substr($_SERVER['HTTP_HOST'],0,3) != 'www')
    {
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://www.PutYourSiteHere.com/');
    }
    ?>
    Simply it redirects the home page with “301 Moved Permanently” to the www url.

    I'm thinking to put this code a php file and include it in the beginning of all my pages:
    <?php
    if (substr($_SERVER['HTTP_HOST'],0,3) != 'www')
    {
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://www.'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
    }
    ?>

    This should redirect all the non www to the www version of the same page, so I could combine the PageRank and stop the search engines from thinking that I have duplicate content.
    What do you think?
     
    ahelpinghand, Apr 30, 2007 IP
  2. eddy2099

    eddy2099 Peon

    Messages:
    8,028
    Likes Received:
    568
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Actually if the site is hosted on Linux, you can just create a .htaccess file and upload it to your root directory. The file is usually not there unless you put it there, if it is not found, the default apache settings would be used.
     
    eddy2099, Apr 30, 2007 IP
  3. ahelpinghand

    ahelpinghand Guest

    Best Answers:
    0
    #3
    You are right my but my host now doesn't allow .htaccess files for security reasons so I'm stuck with that until I move to another host. That's why I thought if using php.
     
    ahelpinghand, Apr 30, 2007 IP
  4. manilodisan

    manilodisan Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Instead of asking and bumping why don't you moved it already to another host?
     
    manilodisan, Apr 30, 2007 IP
  5. boyponga

    boyponga Banned

    Messages:
    1,013
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    boyponga, Apr 30, 2007 IP
  6. goodstar

    goodstar Peon

    Messages:
    755
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    0
    #6

    yes, that is really very usual...

    in my opinion you should always use the same link for your site,
    and ever bother if your site has different PR for www and no www :)
     
    goodstar, Apr 30, 2007 IP
  7. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #7


    you need to put a 301 redirect on blah.com to www.blah.com then the page rank will read the same :)
     
    tdd1984, Apr 30, 2007 IP
  8. boyponga

    boyponga Banned

    Messages:
    1,013
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, I usually use the same URLs in order to get the highest PR I desire, I'd rather put www before my domain name. :)
     
    boyponga, May 5, 2007 IP