help redirecting domain.com to www.domain.com

Discussion in 'Site & Server Administration' started by itsallwhite, Mar 7, 2010.

  1. #1
    I am a bit confused about a site I am working on, everything except the homepage is seems to have the www. in front on it but the homepage seems to default to just http://domain.com

    I submitted my sitemap to google etc and there are lots of errors because my homepage doesnt match my internal page URLs.

    I have a number of links that point to http://domain.com and don't want to lose them.

    The site is bodycleansediet.com

    Is there a way to redirect http://bodycleansediet.com to http://www.bodycleansediet.com and would this have any implications for ranking?

    How do I setup my site to default to www.?

    I've also noticed this URL appearing in some results - http://www.bodycleansediet.com/index.php

    your help is MUCH appreciated! thanks alot
     
    itsallwhite, Mar 7, 2010 IP
  2. aap

    aap Well-Known Member

    Messages:
    1,802
    Likes Received:
    39
    Best Answers:
    2
    Trophy Points:
    120
    #2
    Create a .htaccess file in the /public_html/ directory. If the domain is an add-on domain, then create the .htaccess file in add-on domain's directory.

    Put below code in the .htaccess file
    
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^bodycleansediet.com [NC] 
    RewriteRule ^(.*)$ http://www.bodycleansediet.com/$1 [L,R=301] 
    
    Code (markup):
     
    aap, Mar 7, 2010 IP
  3. itsallwhite

    itsallwhite Peon

    Messages:
    607
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for this, I already have a .ht access file - so should I just add this to it?

    My current .ht access file is below - should it go before or after?
    
    redirect 301 /isogenix.htm /pages/isogenix.php
    redirect 301 /isagenix-reviews/index.html /pages/isagenix-reviews.php
    redirect 301 /drfloras/dr-floras.html /pages/dr-floras-colon-cleanse.php
    redirect 301 /isogenics.htm /pages/isogenics.php
    redirect 301 /isagenix-abc-news-review-videos.html /pages/isagenix-on-abc-news.php
    redirect 301 /isagenix-reviews/isagenix_products_reviewed.php /pages/isagenics-products-review.php
    Code (markup):
     
    itsallwhite, Mar 7, 2010 IP
  4. aap

    aap Well-Known Member

    Messages:
    1,802
    Likes Received:
    39
    Best Answers:
    2
    Trophy Points:
    120
    #4
    yes, just add the code I posted above.
     
    aap, Mar 7, 2010 IP
  5. itsallwhite

    itsallwhite Peon

    Messages:
    607
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks alot for your help, have added it to my site and it seems to be working now
     
    itsallwhite, Mar 8, 2010 IP
  6. itsallwhite

    itsallwhite Peon

    Messages:
    607
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    itsallwhite, Mar 9, 2010 IP