Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
SEO preference for WWW or HTTP:// protocol redirection? Do www websites rank better than NON-www?

One domain would have to be redirected to another, but I have seen both cases - www.example.com being redirected to example.com and vice versa. What's the best practice and does either way have any impact on SEO?

share|improve this question

migrated from stackoverflow.com Sep 30 '11 at 16:26

This question came from our site for professional and enthusiast programmers.

marked as duplicate by danlefree Oct 1 '11 at 3:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

One is not better then the other. What matters is consistency. Choose one and stick with it for all of your URLs.

A good thing to do is specify which one you want Google to use in your Google Webmasters Tools account. Also, doing a 301 redirect from the one you do not use to the other isn't a bad idea. Or, alternatively, you can use canonical URLs to specify your preferred domain but a 301 redirect is probably better since forces consistency upon your users. If you use Apache this code makes it simple:

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^yoursite.com [NC] 
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301] 
share|improve this answer

You should realize that "www" is a subdomain. You can use anything you like, but the convention is that you use "www" for your web site. Other subdomains, like "ftp.example.com" might indicate different services, but they don't need to, and they're just names.

share|improve this answer