301 Redirect Wordpress

Discussion in 'WordPress' started by gary15, Oct 12, 2009.

  1. #1
    I was just checking backlinks and have just noticed that i get different number of backlinks for www and without www. So I did some research and found out that i need to use the 301 redirect so that i dont get penelized by google and so that google doesn't see them as 2 seperate url's.

    So can someone help me out on how to do this? I heard that i'm supposed to change the htaacces file.

    But what do i have to change, this is htaccess code.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Thanks
     
    gary15, Oct 12, 2009 IP
  2. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #2
    Just install a plugin. A SEO one or a canonical URL one will do what you want.
     
    Last edited: Oct 12, 2009
    aaron_nimocks, Oct 12, 2009 IP
  3. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    437
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or add this to it:

    
    RewriteCond %{HTTP_HOST} ^yourdomain\.tld [NC] 
    RewriteRule .? http://www.yourdomain.tld{REQUEST_URI} [R=301,L]
    
    Code (markup):
    (replace yourdomain with your domain name and tld with your top level domain such as com net org)
     
    Dan Schulz, Oct 12, 2009 IP
  4. affilimate

    affilimate Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ha ha, i was just trying to figure out how to do this today Dan where does the code go for the non techie? or would it be easier to just install the plugin below? (any upsides downsides?)
     
    affilimate, Oct 12, 2009 IP
  5. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #5
    Doesn't matter which way you do it. If you edit the .htaccess it won't effect anything else. Which ever way is easier for you. :)
     
    aaron_nimocks, Oct 12, 2009 IP
  6. affilimate

    affilimate Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks Aaron
     
    affilimate, Oct 12, 2009 IP
  7. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    437
    Best Answers:
    0
    Trophy Points:
    0
    #7
    For the sake of sanity, I'd put it after the /index.php [L] rewrite rule.
     
    Dan Schulz, Oct 12, 2009 IP
  8. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I could have sworn that wordpress strips the www automatically. At least with wpmu it does this. Been awhile since I used the regular wp software.

    Usually the plugins are for adding the 'www' bit back in.
     
    theapparatus, Oct 12, 2009 IP