Duplicate Content and htaccess

Discussion in 'Search Engine Optimization' started by joelmr, May 21, 2008.

  1. #1
    Hey,

    I saw a thread about a couple of days ago about the topic (but I can't find it anymore), and it said that SE look www.domain.com and domain.com as different sites, and this could result in bad SERP results for duplicate content.

    I also saw a reply saying that it could be fixed by modifying the htaccess file, and it showed how to. Could you tell me what to do, and how to do it? Thanks.
     
    joelmr, May 21, 2008 IP
  2. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #2
    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] 
    
    Code (markup):
    Change yourdomain.com to your proper domain name, make sure to leave all variables intact "/" "$1"
     
    astup1didiot, May 21, 2008 IP
  3. joelmr

    joelmr Banned

    Messages:
    291
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok, and do I add it anywhere?
     
    joelmr, May 21, 2008 IP
  4. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #4
    .htaccess file is where the code goes.
     
    astup1didiot, May 21, 2008 IP
  5. joelmr

    joelmr Banned

    Messages:
    291
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah, but I mean, do I add it anywhere within the .htaccess file?
     
    joelmr, May 21, 2008 IP
  6. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #6
    Yes, thats fine as long as no other code is conflicting.
     
    astup1didiot, May 21, 2008 IP