Do you want to improve your search engine rankings? SEO gurus told you that Google might be penalizing you for duplicate content? How did you get duplicate content, you ask? Unless you specify otherwise, we send www.yourdomain.com and yourdomain.com to the same place. Which is great because some clients automatically add a WWW to every url they type, and others almost never add www even if you tell them to. This way they end up at the correct page, regardless of what else they’ve included in their url.
The problem is that if people are linking to you sometimes with a www and sometimes without, spiders may think you’re trying to get away with publishing the same information twice. So some SEO experts have recommend you create a 301 redirect to send all non-www links to www.
You try it, and to your horror, the page now loops through so many redirect iterations that the site won’t display at all. Or, you try the common syntax and it messes up all your subdomains.
There is hope. Here is a 301 redirect syntax that does not loop, and does not affect your subdomains either.