duplicate content problem - mod_rewrite?

Discussion in 'Search Engine Optimization' started by eliterasta, May 19, 2008.

  1. #1
    im having a duplicate content problem.
    both http://www.mysite.com and http://mysite.com are indexed by search engines. most of my backlinks point to http:.//www.mysite.com so i need to remove http://mysite.com from searches. after doing some research i found that i need to use mod_rewrite in .htaccess to fix this problem. but im a little bit confused on the exact code i need to use to fix it.
    can some on help me out?

    also i believe i have already been penalized for this, my search ranking have dropped. after i fix this will the penalty be lifted and my rankings go back?
     
    eliterasta, May 19, 2008 IP
  2. jg_abad

    jg_abad Peon

    Messages:
    903
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hello,
    if u have submit google sitemap in google webmaster tool, you can directly remove it from there. kindly check it out, you will get solution.
     
    jg_abad, May 19, 2008 IP
  3. Dee2007

    Dee2007 Active Member

    Messages:
    1,185
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    88
    #3
    Hi, you should do a 301 redirect, to redirect the non www to the www. I have just done this myself.

    You may initially drop in the SERPS but this should only be a short term effect, and in the long term you may even rank a few places higher, (I was told this by a very knowledgable guy, here on DP) one you have corrected the duplicate problem.

    Here is the redirect code

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.yoursite\.co.uk$
    RewriteRule (.*) http://www.yoursite.co.uk/$1 [R=301,L]

    Dee
     
    Dee2007, May 19, 2008 IP
  4. eliterasta

    eliterasta Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thank you dee
    i will give it a try.
     
    eliterasta, May 19, 2008 IP
  5. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #5
    This is the proper code to use, don't use the above one.

    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] 
    
    Code (markup):
    Change yourdomain.com to your domain name, leave all variables around it intact.
     
    astup1didiot, May 19, 2008 IP
  6. eliterasta

    eliterasta Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    lol, i see first one puts site in a loop.
    thank you, ssandecki

    there is too much confustion on web for this information.
     
    eliterasta, May 19, 2008 IP
  7. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #7
    After being on DP long enough you'll learn who to listen to and who to ignore :)
     
    astup1didiot, May 19, 2008 IP
    eliterasta likes this.
  8. Dee2007

    Dee2007 Active Member

    Messages:
    1,185
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    88
    #8
    I actually think that comment was not needed. Just like you supplied the code. Someone of this forum supplied me with the one I posted.

    Dee
     
    Dee2007, May 19, 2008 IP
  9. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #9
    Sorry, I write the code; I don't copy and paste not knowing if it works or not. ;)
     
    astup1didiot, May 19, 2008 IP
  10. Dee2007

    Dee2007 Active Member

    Messages:
    1,185
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    88
    #10
    Well I did test it and it did work, but obviously because of the code it was going to take me to the www, but hey no need to shoot me over it, at the end of the day I was only trying to help, and everyone makes mistakes occasionally ;)

    Dee
     
    Dee2007, May 19, 2008 IP
  11. ninjashoes

    ninjashoes Well-Known Member

    Messages:
    1,401
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    138
    #11
    you can also choose which one gets indexed in google webmaster tools
     
    ninjashoes, May 19, 2008 IP
  12. BlastLTD

    BlastLTD Member

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #12

    Thanks! Might have to use this myself.
     
    BlastLTD, May 20, 2008 IP
  13. chaitanya.seo

    chaitanya.seo Banned

    Messages:
    625
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Hey Deed and Ssandecki, you should not put your self in personal opinion and expertise.

    Ssandecki, you are the respected member of DP, leave that guy or explain him, why he is wrong.

    Hope this will make friendly environment between every one in DP.

    Enjoy.
     
    chaitanya.seo, May 20, 2008 IP
  14. BlastLTD

    BlastLTD Member

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #14
    LOl, ok I guess I missed the proper code:)
     
    BlastLTD, May 20, 2008 IP