is this 301 redirect OKAY ??

8 replies
  • SEO
  • |
Hi, numerous resources suggest this exact redirect code for the .htaccess file if you want non-www to redirect to www:
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]

However, I've been worried about "duplicate content" because my homepage gets displayed even when the "www" is messed with, for example:
www3.example.com
abcdef1234.example.com

So over at the apache forums, they suggested this:
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]

That does work. However, before I implement it, I wanted to make sure it is "SEO friendly," e.g. it's not doing something horrible for the search engines that I don't know about yet.

What do you guys think? :confused:
#301 #redirect
  • Profile picture of the author Michael Nguyen
    Originally Posted by oldvintageguy View Post

    Hi, numerous resources suggest this exact redirect code for the .htaccess file if you want non-www to redirect to www:
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]

    However, I've been worried about "duplicate content" because my homepage gets displayed even when the "www" is messed with, for example:
    www3.example.com
    abcdef1234.example.com

    So over at the apache forums, they suggested this:
    RewriteCond %{HTTP_HOST} !^(www.example.com)?$
    RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]

    That does work. However, before I implement it, I wanted to make sure it is "SEO friendly," e.g. it's not doing something horrible for the search engines that I don't know about yet.

    What do you guys think? :confused:
    I've been studying regular expression so I can comment. Its perfectly fine. What you're doing is telling Google which is preferred which is the www.version and only www.

    If it redirects with ie www3.domain.com then you're fine.
    Signature
    {{ DiscussionBoard.errors[4577290].message }}
    • Profile picture of the author paulgl
      It's not duplicate content. it's the same page. Just multiple
      ways of getting there.

      A 301 in that case is not really SEO, although many mix it up.

      It's just your preferred way of getting there. If you don't build
      consistent backlinks, then google will just choose which one
      makes more sense to them. It "looks" like they are different pages.
      It does not mean that they are different. Google is a pretty
      smart cookie in this regard. Whether you 301 or not, it does
      not solve people's perceived problems about the page appearing
      to be a different page to search engines.

      Thinking there is a problem, and putting a band aid on the problem,
      is not really SEO if it's not really a problem. Right?

      It's no big deal.

      You see a lot of people claiming the sky is going to fall, but
      no such thing happens.

      domain.com, domain.com/ domain.com/index.php, www. domain.com,
      www .domain.com/ www .domain.com/index.php, and many, many
      others are the same page.

      The only way you get in trouble is for type in traffic. If your
      www. subdomain does not exist due to the way the server was
      set, and you don't do a 301, and people type www. first, the
      site will be non-existent.

      None of this is duplicate content, nor anything to worry about
      for 99.99999999999999999999999999% of normal websites.

      You can also do this another way, using rel="canonical"

      Just google it. It's actually a pretty neat line of code that many
      people don't know about.

      Paul
      Signature

      If you were disappointed in your results today, lower your standards tomorrow.

      {{ DiscussionBoard.errors[4577467].message }}
  • Profile picture of the author Michael Nguyen
    just to add, if these urls were to be indexed
    www3.example.com
    abcdef1234.example.com

    aswell as your main url www.example. com, then
    that WOULD be duplicate content.

    Stick the code into the htaccess file you should be
    good.
    Signature
    {{ DiscussionBoard.errors[4577768].message }}
    • Profile picture of the author oldvintageguy
      Originally Posted by Michael Nguyen View Post

      just to add, if these urls were to be indexed
      www3.example.com
      abcdef1234.example.com

      aswell as your main url www.example. com, then
      that WOULD be duplicate content.

      Stick the code into the htaccess file you should be
      good.
      Michael, hi, thank you for your answer. And, yes! abcdef1234.example.com DID get indexed -- that's how I discovered it

      When I was looking up my own website (e.g. "site:www.mysite.com"), you know those little snippet things under your domain name where the search engine lists all my main pages, well, one of them looked just like this:
      anotherwebsiteNamewww.mysite.com/mypage.html. It sure spooked me, and I wanted it fixed, but no matter what redirect I tried, nothing worked, until I went over to the apache forum. Thank you for reviewing my code.
      {{ DiscussionBoard.errors[4578346].message }}
  • Profile picture of the author riza
    how about linkjuice? I know the standard answer is that the link juice gets transferred to the new url, but does anyone have experience doing this? If so were there any changes noticed?
    {{ DiscussionBoard.errors[4577869].message }}
  • Profile picture of the author arnie19
    Temporarily, you'll dropped rankings. but will return. Not sure how long though.
    {{ DiscussionBoard.errors[4578397].message }}
  • Profile picture of the author Incoan
    Uhmm...I did 301 redirects once to change permalinks. Didn't drop in rankings at all.
    {{ DiscussionBoard.errors[4578436].message }}
  • Profile picture of the author arnie19
    Uhmm...I did 301 redirects once to change permalinks. Didn't drop in rankings at all.
    Are those pages reindexed? Well to me, it happen, 301 redirect from non-www to www. after a month.booom!! I'm gone. but after a couple of months,I'm back. I think it depends on pages you have since mine before, I had lots of pages and it took time to get them reindexed again. Anyway, no doubt that you won't have a problem since google advices 301 redirect.
    {{ DiscussionBoard.errors[4579586].message }}

Trending Topics