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?
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: