301 Redirect to Avoid Duplicate Content Penalties with the Search Engines

Discussion in 'Search Engine Optimization' started by txchou, Dec 28, 2005.

  1. #1
    Implemented like so:

    
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^yoursite.com [NC] 
    RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301] 
    
    Code (markup):
    it seems to work fine, i've heard that I need to change links to folders so that they include a trailing slash.

    My question is: is this true and if so, does it also apply to links which are htaccess created permalinks? (since its a fair amount of work which if possible i'd like to avoid)
     
    txchou, Dec 28, 2005 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    As long as you are consitant you will be fine. Choose one type of link and stick to it.
     
    mad4, Dec 28, 2005 IP
  3. asing

    asing Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    heres a variation of the redirect
    the '!' means NOT - so the condition is true if the HTTP HOST is NOT like www.yoursite.com
    this is more flexible and will also redirect if you have other versions of your domain name on the server (your-site.com) or use other tlds (.de, .net etc)

    
    Options +FollowSymLinks 
    RewriteEngine on 
    rewriteCond %{HTTP_HOST} !^www.yoursite.com
    rewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
    
    Code (markup):
    you might need to escape the dots in the rewriteCond...
    rewriteCond %{HTTP_HOST} !^www\.yoursite\.com

    this doesnt need the [NC] because YourSite.coM also fulfills the condition and will redirect

    I think folders should be linked to with a trailing slash

    and if so I guess that applies to the permalinks since the browser / spider doesnt know whats gone on behind the web server

    a.
     
    asing, Dec 28, 2005 IP
  4. MountainLife

    MountainLife Well-Known Member

    Messages:
    622
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    120
    #4
    you can only do this if you have server control and are not just hosted right?
     
    MountainLife, Dec 28, 2005 IP