1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Making domain.com -> www.domain.com

Discussion in 'Search Engine Optimization' started by Inka, May 21, 2005.

  1. #1
    I have been reading through this forum and this is my first post here, I'd like to say hi. Anyways, I found this code for getting www.domain.com -> domain.com:

    But I want to do this: domain.com -> www.domain.com

    I tried playing around with it, no luck, I thought I would ask other members as they seem very helpful from the threads I have gone through.

    Thanks for you help.
     
    Inka, May 21, 2005 IP
  2. nfd2005

    nfd2005 Well-Known Member

    Messages:
    295
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    130
    #2
    Hi,

    Here's a possible solution using PHP:

    It's basically saying that if the host address is domain.com then it will redirect to www.domain.com

    Hope I could help.
     
    nfd2005, May 21, 2005 IP
    Epica likes this.
  3. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #3
    This will do what you describe:
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
    
    Code (markup):
     
    ResaleBroker, May 21, 2005 IP
  4. Inka

    Inka Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks guys, I used ResaleBroker's way, it worked fine.
     
    Inka, May 21, 2005 IP
  5. ovisopa

    ovisopa Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    RewriteCond %{HTTP_HOST} !^www
    RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R]

    I use this way and works great too :)
     
    ovisopa, Nov 8, 2005 IP
  6. Nokia999

    Nokia999 Guest

    Messages:
    1,488
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    0
    #6
    After all what is benefit of doing so?
     
    Nokia999, Nov 8, 2005 IP
  7. bentong

    bentong Banned

    Messages:
    3,543
    Likes Received:
    257
    Best Answers:
    0
    Trophy Points:
    0
    #7
    this will pass the pr of domain.com to www.domain.com
     
    bentong, Nov 9, 2005 IP
  8. xponse

    xponse Peon

    Messages:
    93
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    good .htaccess code ResaleBroker

    some time you see following problem with PR :

    1) domain.com PR0
    2) www.domain.com PR4

    above problem can be solved by following .htaccess code

    -----------
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301]
    ----------------

    I do not prefer to use PHP code for redirection

    mainly that process will help for ( URLs - Relative Vs. Absolute )
     
    xponse, Nov 9, 2005 IP
  9. soul-healer

    soul-healer Peon

    Messages:
    1,459
    Likes Received:
    145
    Best Answers:
    0
    Trophy Points:
    0
    #9
    soul-healer, Nov 18, 2005 IP
  10. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #10
    No. A PR4 + a PR2 does not equal a PR6 when you're talking about PR. Since PR is based on a logarithmic scale, a 2 + 4 doesn't equal 6. a PR 5 if you're lucky, but I highly doubt that it could raise up to a PR6.

    The main benefit that I can see is preventing duplicate content.
     
    jestep, Nov 18, 2005 IP
    soul-healer likes this.
  11. soul-healer

    soul-healer Peon

    Messages:
    1,459
    Likes Received:
    145
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks for the answer :)
     
    soul-healer, Nov 18, 2005 IP
  12. grandmac

    grandmac Guest

    Messages:
    79
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Google has both with and without the www indexed for me. Both have the same page rank but one has more pages listed. I am wondering if this is hurting my site as being duplicate content. If I used the codes above would there be an advantage to having www point to the one without or the other way around? Would the one with the most pages indexed automatically be the best one to have the other one point to?
    Thanks,
    Carol
     
    grandmac, Nov 20, 2005 IP