how to create redirect for domain.com vs www.domain.com

Discussion in 'Search Engine Optimization' started by Cball, Feb 18, 2009.

  1. #1
    Can anyone explain how to make a redirect for the domain.com vs the www.domain.com?

    Will this help with my rankings?

    Thank you!
     
    Cball, Feb 18, 2009 IP
  2. ColeenB

    ColeenB Peon

    Messages:
    123
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If your site is hosted on Linux (not Windows) you can do it with a .htacess file.

    If you already have a file called .htaccess in the root directory on your server, add this code to it (replacing domain.com in both place with your domain name, of course).

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

    If you don't have a .htaccess file, go into Notepad and copy this code into it. Save it as .htaccess (you need the . at the beginning) and upload that file to your root directory.

    Yes, it will help with rankings because it will consolidate inbound links. Without it, the search engines treat domain.com and www.domain.com as two separate sites.

    Good luck!
     
    ColeenB, Feb 18, 2009 IP
  3. Cball

    Cball Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you!

    When I do this, it shows in my root as .htaccess.txt and doesn't seem to be redirecting. Is there some other way that I need to save it?
     
    Cball, Feb 18, 2009 IP
  4. Cball

    Cball Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It worked! I removed the .txt extension and now it works. Thank you.

    Should I change the settings in google webmaster tools from both non www and www to just www? Or is that unrelated?
     
    Cball, Feb 18, 2009 IP
  5. teo123

    teo123 Banned

    Messages:
    500
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Set it to whichever you want Google to recognize it as.
     
    teo123, Feb 18, 2009 IP
  6. Styxbowl20v

    Styxbowl20v Active Member

    Messages:
    231
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #6
    Styxbowl20v, Feb 18, 2009 IP
  7. kutekutta

    kutekutta Peon

    Messages:
    807
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7

    Thank you Coleen. Nice information :)
     
    kutekutta, Feb 18, 2009 IP