www is a subdomain of domain.com and if you are using Apache on Linux you can easily do that by adding few lines in your .htaccess file
Check out Search Engine Optimization FAQ's
and see the question
Why does my website have a higher PR with the 'www' then without it?
Where I have the code for both. Going from www to non www and vice versa