.htaccess + Wordpress - 301

Discussion in 'Apache' started by Letcha, Apr 2, 2009.

  1. #1
    I'd like my blog to redirect from www.my.tld to my.tld - It currently does this, but I'm using wordpress, so it's a 302 redirect. What's the best way to change this to a 301 redirect. I'd tend to think I'd wanna do it using .htaccess, but is there a chance that could mess up plugins that I'm using? I have a good amount of them installed.

    Also, I've found plenty of tutorials on ModRewrite for redirecting from non-www to www, but not vice versa. Any assistance/advice here would be much appreciated. Thanks!
     
    Letcha, Apr 2, 2009 IP
  2. Letcha

    Letcha Active Member

    Messages:
    621
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    93
    #2
    I've looked into this some more. It seems like some people rely on wordpress to do this for them. I'm pretty sure it's still doing a 302 direct though, which is temporary, and I don't think that passes PR. So if I have a variety of backlinks - Some pointing to www, some to the non-www, I'm not taking full advantage of them. At least that's my understanding.

    How do you handle this?
     
    Letcha, Apr 3, 2009 IP
  3. Letcha

    Letcha Active Member

    Messages:
    621
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    93
    #3
    I've spent a lot of time looking into this and still can't find anything that answers my question. Has no one else run into this issue?
     
    Letcha, Apr 6, 2009 IP
  4. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #4
    You can set 301 for www to non-www using following htaccess rule:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
    RewriteRule ^(.*) http://doamin.com/$1 [R=301,L]

    Also you can set non-www URL from your Google web master tools.

    Kailash
     
    kailash, Apr 13, 2009 IP