If you have ever read my article Redirecting URL Without www to URL With www Using .htaccess File regarding how to redirect the URL of a website from its address that being typed by visitor without the prefix www become the address with prefix www, then the redirecting script will not be useful at all. For example, your main website domain is mydomain.com, then by using that redirect script in that article, if you have subdomain, for instance, mysubdomain.mydomain.com which this mysubdomain sub directory will be located under the root of your mydomain.com, then your URL will be converted to: http://www.mydomain.com/mysubdomain/. Of course, we do not expect this condition happened, right? So, how is the solution?
Well, if you use the redirect script which we have discussed in that article above, you should remove it from your .htaccess file in order your URL will be displayed properly become http://mysubdomain.mydomain.com. In the other words, since you used the subdomain, you have to reconsider about the using of that redirect script, if you do not want the URL of your subdomain changed as we mentioned above.
I discovered about this behavior when I created a subdomain for my another website. I hope this information will be useful for you.

This is only test for implementing SI Captcha Plugin for my website. Bye bye spam!
Nice post. Your information is so useful. thanks. I come across your web today, I find it so good, I will pay attention to your web from today.
Very useful info… I read both the articles (this one and the one that talks about “Redirecting URL Without www to URL With www Using .htaccess File”)
* so in your experience, what is the combined solution. One that redirects URL with www to URL with www and also allows subdomain on the website?
* According to the the following URL, you should never use .htaccess files unless you don’t have access to the main server configuration file.
http://httpd.apache.org/docs/2.0/howto/htaccess.html
Any comments based on your experience?
Thanks!
@Dilip Shah
* Well, the best solution is by using WordPress! LoL. Sounds like an advertising, huh? But it does not. WordPress has the ability to automatically redirect to the fixed URL that we define in Settings -> General in its admin page without having to define explicitly in the .htaccess file. For example, a visitor type in his browser this URL: h++p://mywebsite.com, but because of the URL settings in that site that using WordPress has been defined as: h++p://www.mywebsite.com, then that visitor will be automatically redirected to the correct URL: h++p://www.mywebsite.com.
* That’s right. I agree with that article, especially for that reason. That’s why I always choose WordPress each time I create my another new website. WordPress is the best CMS I ever used until now.
You’re welcome.